遺失 ext4 分割區:testdisk 列出文件,但無法修復分割區表

遺失 ext4 分割區:testdisk 列出文件,但無法修復分割區表

概括:

Testdisk 找到遺失的 ext4 分割區並能夠列出包含的文件,但嘗試將分割區結構寫入磁碟不會執行任何操作。

更新:運作後e2fsck -f /dev/sdc1,磁碟已掛載,運作正常。然而,它也報告了一些錯誤(請參閱下面的 15)。

發生了什麼事:

我將嘗試列出我所做的與該問題相關的所有內容:

  1. 我購買了一個新的 5TB 外接硬碟,已預先格式化為 FAT32(名為 Intenso)。
  2. 我刪除了該分割區並使用 gparted 建立了一個新的 ext4 分割區(名為 Intenso5TB)。
  3. 由於該分割區屬於 root,因此我將所有者和群組更改為我的使用者。
  4. 我將數百 GB 的資料移至該分割區,然後安全地將其刪除。
  5. 下次我插入硬碟時,它被安裝為唯讀。我的用戶仍然是所有者。
  6. 我將“rw”添加到 Ubuntu 的“磁碟”實用程式的安裝選項中,並卸載了驅動器。
  7. 然後,磁碟實用程式將分割區 /dev/sdc1 顯示為「類型未知」且無法安裝。
  8. 我選擇“編輯分割區”並選擇“類型 linux (0x83)”(未預先選取類型)。沒有變化(仍然類型未知)。
  9. 我運行sudo testdisk /dev/sdc並進行了快速分析,結果發現:

    * Linux                    0   4  5 76000  41  9 1220942336 [Intenso5TB]
    

    按下p顯示我移動到分區的文件,所以我告訴Testdisk將分區結構寫入磁碟。

  10. 再次重新啟動以刷新分區表後,行為再次如 7 所述。
  11. 我重做了9。這次我嘗試使用

    partprobe /dev/sdc
    

    為了避免再次重新啟動,但收到訊息:

    Error: Partition(s) 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sdc have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
    
  12. sudo fdisk -lu回報

    Disk /dev/sdc: 4,6 TiB, 5000981078016 bytes, 1220942646 sectors
    Units: sectors of 1 * 4096 = 4096 bytes
    Sector size (logical/physical): 4096 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 33550336 bytes
    Disklabel type: dos
    Disk identifier: 0x4400838c
    
    Device     Boot Start        End    Sectors  Size Id Type
    /dev/sdc1  *      256 1220942591 1220942336  4,6T 83 Linux
    
  13. sudo parted /dev/sdc然後我運行rescue 256 1220942591它什麼也沒做(沒有延遲,沒有輸出,只是在parted內有一個新的命令提示符),與rescue 0 1220942591,rescue 1 1220942591或相同rescue 1 -1

  14. 我用 Testdisk 進行了深入搜索,它報告了幾行相同的內容:

    Linux                    0   4  5 76000  41  9 1220942336 [Intenso5TB]
    

    也:

    check_FAT: can't read FAT boot sector
    Invalid FAT boot sector
     0 D FAT16 LBA            252822 192 45 254047 161 57   19677685
      FAT16 LBA            252822 192 45 254047 161 57   19677685
    

    運行時並關閉:

    TestDisk 7.0, Data Recovery Utility, April 2015
    Christophe GRENIER <[email protected]>
    http://www.cgsecurity.org
    
    Disk /dev/sdc - 5000 GB / 4657 GiB - CHS 76000 255 63
    
    The harddisk (5000 GB / 4657 GiB) seems too small! (< 16 TB / 15 TiB)
    Check the harddisk size: HD jumpers settings, BIOS detection...
    
    The following partition can't be recovered:
         Partition               Start        End    Size in sectors
    >  FAT16 LBA            252822 192 45 254047 161 57   19677685
    
    
    
    
    
    
    
    
    
    
    [ Continue ]
    80 GB / 75 GiB
    
  15. 運行後e2fsck -f /dev/sdc1,磁碟出現在啟動器中。在我了解更多之前,我取消了e2fsckCtrl+C避免進一步的更改。然後點擊即可成功安裝驅動器。我似乎能讀能寫。輸出來自e2fsck

    e2fsck -f /dev/sdc1
    e2fsck 1.42.13 (17-May-2015)
    ext2fs_open2: Bad magic number in super-block
    e2fsck: Superblock invalid, trying backup blocks...
    Superblock needs_recovery flag is clear, but journal has data.
    Recovery flag not set in backup superblock, so running journal anyway.
    Intenso5TB: recovering journal
    Pass 1: Checking inodes, blocks, and sizes
    Inode 59883521 is in use, but has dtime set.  Fix<y>? yes
    Inode 59883521 has imagic flag set.  Clear<y>? yes
    Inode 59883521 has compression flag set on filesystem compression support.  Clear<y>? yes
    Inode 59883521 has INDEX_FL flag set but is not a directory.
    Clear HTree index<y>? yes
    Inode 59883521, i_blocks is 16777216, should be 0.  Fix<y>? yes
    Deleted inode 59885573 has zero dtime.  Fix<y>? yes
    Deleted inode 59885574 has zero dtime.  Fix<y>? yes
    ^CIntenso5TB: e2fsck cancelled.
    
    Intenso5TB: ***** FILE SYSTEM WAS MODIFIED *****
    

我的問題:

  1. 我是否犯了任何明顯的錯誤,可能首先導致了這個問題?

  2. 有希望恢復遺失的分割區嗎? 新問題:報告的錯誤是否e2fsck值得擔心?他們是否暗示驅動器有物理損壞?

  3. partprobe11 中的錯誤訊息是什麼原因導致的?

(資料是從我從未接觸過的另一個磁碟移走的,因此,雖然現在不可見,但應該可以從那裡搶救。)

答案1

運行e2fsck -f /dev/sdc1修復了一個壞的超級塊,並且設備被正常識別。然後我讓它e2fsck解決它發現的所有問題。在隨後的運行中e2fsck沒有報告任何進一步的錯誤。

延長的離線測試在smartctl9 小時後完成,報告沒有錯誤(為了防止自動降速中止測試,我應用了這個解決方法)。

相關內容