从外部硬盘恢复“不可见”文件

从外部硬盘恢复“不可见”文件

我的外部硬盘(WD Elements)刚刚进入一种奇怪的状态,我问这个问题是为了看看是否有人能理解这一点。

我晚上运行了一项很长的工作,从该硬盘读取一些大文件,处理它们,然后将一些较小的文件写回硬盘。早上,工作完成后,似乎大多数文件都从外部驱动器中删除了。

使用 dolphin 或ls仅该作业应该写入的一些文件在那里,其他文件则不在那里。此外,该作业仅应读取的所有大文件都丢失了。

但是,如果其中一个大文件已被删除,则作业应该会失败。事实上,如果我从记忆中输入它们的名称,我实际上可以读取这些“不存在”的文件(例如我能够将cp他们带到另一个位置)。该工作已成功完成,所有文件均已写入,但类似的工具ls不会显示它们(我也尝试卸载和重新安装)。

我通过记住文件路径解决了这个问题,但是如果您不记得这些文件,有没有办法恢复?

我在 Ubuntu 22.04 上,外部硬盘有 ntfs3:

$ df -hT
...
/dev/sdb1               ntfs3     1,9T  863G 1001G  47% /media/marc/Elements

编辑

这项工作是一个 python 脚本,它使用 读取 grib 文件,pupygrib使用 .nc 文件读取 nc 文件netCDF4。后来找不到所有 grib 和 nc 文件ls(即使它们仍然存在)。对于python 中的文件句柄,pupygrib使用C 模式打开文件。open(..., "rb")netCDF4"r"

为了编写,Python 脚本用于pyarrow编写 parquet 文件。其中一些文件“丢失了”(尽管如上所述,它们实际上仍然存在)。据我所知, Python 中pyarrow用于open(..., 'wb')打开文件进行写入。

在将文件复制回硬盘时,我注意到某些文件在重命名后似乎也消失了(使用mv)。不过,我没有注意到任何系统性的消失(例如某些名称往往会消失)。所有路径名仅包含字符 aZ、数字 0-9、_/.-。最长的路径名长度为 110 个字符。

智能监控工具

$ sudo smartctl -q noserial -a /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.5.0-10022-tuxedo] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD20SDRW-11VUUS0
Firmware Version: 01.01A01
User Capacity:    2.000.365.379.584 bytes [2,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Feb  3 13:07:08 2024 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (14640) seconds.
Offline data collection
capabilities:                    (0x51) SMART execute Offline immediate.
                                        No Auto Offline data collection support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 298) minutes.
SCT capabilities:              (0x7035) SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   196   190   021    Pre-fail  Always       -       3158
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       216
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       316
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       51
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       27
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       2773
194 Temperature_Celsius     0x0022   113   098   000    Old_age   Always       -       34
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%       316         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

相关内容