Fsck

fsck.vfat 無法修復 USB

  • April 11, 2016

背景

去年,當我在 Window 的文件資源管理器中使用 Ctrl-C 和 Ctrl-V 將超過 600MB 的大型影片文件從桌面複製到我的 U 盤時,我忘記了我的 U 盤只有 4GB 的儲存空間。從那時起,它就被破壞了。

我嘗試將其插入桌面。它安裝了幾秒鐘,然後卸下了。這樣重複幾次,然後就打不開了。

問題

今晚,我試圖/dev/sdg1fsck. 我從Question Overflow學習了命令。執行以下命令時安裝它。

# dosfsck -w -r -l -a -v -t /dev/sdg1 > err4.txt
# cat err4.txt
fsck.fat 3.0.26 (2014-03-07)
fsck.fat 3.0.26 (2014-03-07)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "MSDOS5.0"
Media byte 0xf8 (hard disk)
      512 bytes per logical sector
     4096 bytes per cluster
      960 reserved sectors
First FAT starts at byte 491520 (sector 960)
        2 FATs, 32 bit entries
  3948544 bytes per FAT (= 7712 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 8388608 (sector 16384)
   987038 data clusters (4042907648 bytes)
63 sectors/track, 255 heads
       62 hidden sectors
  7912688 sectors total
Checking file /
Checking file /Personal Data (PERSON~1)
Checking file /LATEX
Checking file /JFSW2.EXE
...
Checking file /Personal Data/Pc-Lock pictures/PF830.JPG
Checking file /Personal Data/Pc-Lock pictures/SD.JPG
Checking file /Personal Data/Pc-Lock pictures/SSD.JPG
Checking file /Personal Data/Pc-Lock pictures/StoreJet.jpg (STOREJET.JPG)
Checking file /Personal Data/My Folders/.
Checking file /Personal Data/My Folders/..
Checking file /Personal Data/My Folders/Pictures.zip (PICTURES.ZIP)
/Personal Data/My Folders/Pictures.zip
 Cluster 188 (133912) is unreadable. Skipping it.
/Personal Data/My Folders/Pictures.zip
 Cluster 188 (133913) is unreadable. Skipping it.
/Personal Data/My Folders/Pictures.zip
 Cluster 188 (133914) is unreadable. Skipping it.
/Personal Data/My Folders/Pictures.zip
 Cluster 188 (133915) is unreadable. Skipping it.
...
/Personal Data/My Folders/Pictures.zip
 Cluster 188 (135168) is unreadable. Skipping it.

然後我觀察到它/dev/sdg1變成了/dev/sdh1,但我根本沒有觸摸 U 盤。

這是有關我的桌面和 USB 記憶棒的文件系統類型的資訊。 /dev/sda3並且/dev/sda5分別是CD驅動器。 /dev/sda6-8適用於 Ubuntu。

# blkid
/dev/sda1: UUID="2CD3-8FE2" TYPE="vfat" 
/dev/sda2: LABEL="RECOVERY" UUID="581C73CC1C73A422" TYPE="ntfs" 
/dev/sda3: LABEL="OS" UUID="432124AD08015DA8" TYPE="ntfs" 
/dev/sda5: UUID="76EA5D8F396390CF" TYPE="ntfs" 
/dev/sda6: UUID="710414a3-c379-4c9f-b4cd-8781c6612e41" TYPE="ext4" 
/dev/sda7: UUID="13d1958a-e6ac-4b73-b597-2ef17f92dade" TYPE="ext4" 
/dev/sda8: UUID="1338c1b0-7265-440a-ad76-a400cddc0a32" TYPE="swap" 
/dev/sda9: UUID="58c3ff6b-f241-4c41-964f-022388db1755" TYPE="ext4" 
/dev/sda10: UUID="H8XCbA-MEf2-9SSd-bffN-sXyJ-Mvcj-SwCnlG" TYPE="LVM2_member" 
/dev/mapper/vg_014199203162-lv_swap: UUID="cda4c7ab-0b84-4c12-8f55-9823c12c8950" TYPE="swap" 
/dev/mapper/vg_014199203162-f17root: LABEL="_Fedora-17-i686-" UUID="338fb7fe-261f-4a7f-ac57-fd16b4e21792" TYPE="ext4" 
/dev/mapper/vg_014199203162-home: UUID="b19cf480-f882-4093-9683-edc9b2365931" TYPE="ext4" 
/dev/sdg1: UUID="08F1-B181" TYPE="vfat"

去年,我從tty1使用screendump. 我觀察到這些塊16384-16391反復出現。

$ ls /media/owner/08F1-B181/
[ 2543.126034] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2543.127680] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2543.129345] FAT-fs (sdf1): Directory bread(block 16386) failed
[ 2543.131001] FAT-fs (sdf1): Directory bread(block 16387) failed
[ 2543.132664] FAT-fs (sdf1): Directory bread(block 16388) failed
[ 2543.133720] FAT-fs (sdf1): Directory bread(block 16389) failed
[ 2543.134689] FAT-fs (sdf1): Directory bread(block 16390) failed
[ 2543.135658] FAT-fs (sdf1): Directory bread(block 16391) failed
$ sudo screendump > err1.txt

[ 2492.101487] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2492.103723] FAT-fs (sdf1): Directory bread(block 16386) failed
[ 2492.105919] FAT-fs (sdf1): Directory bread(block 16387) failed
[ 2492.108077] FAT-fs (sdf1): Directory bread(block 16388) failed
[ 2492.109698] FAT-fs (sdf1): Directory bread(block 16389) failed
[ 2492.111242] FAT-fs (sdf1): Directory bread(block 16390) failed
[ 2492.112755] FAT-fs (sdf1): Directory bread(block 16391) failed
$ sudo screendump > err1.txt
[ 2505.637759] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2505.640392] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2505.642960] FAT-fs (sdf1): Directory bread(block 16386) failed
[ 2505.645479] FAT-fs (sdf1): Directory bread(block 16387) failed
[ 2505.646969] FAT-fs (sdf1): Directory bread(block 16388) failed
[ 2505.648361] FAT-fs (sdf1): Directory bread(block 16389) failed
[ 2505.649739] FAT-fs (sdf1): Directory bread(block 16390) failed
[ 2505.651098] FAT-fs (sdf1): Directory bread(block 16391) failed
[ 2505.652455] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2505.653776] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2505.655073] FAT-fs (sdf1): FAT read failed (blocknr 1264)
-bash: err1.txt: Input/output error
$ ls
[ 2514.902553] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2514.904685] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2514.906765] FAT-fs (sdf1): Directory bread(block 16386) failed
[ 2514.908830] FAT-fs (sdf1): Directory bread(block 16387) failed
[ 2514.910083] FAT-fs (sdf1): Directory bread(block 16388) failed
[ 2514.911230] FAT-fs (sdf1): Directory bread(block 16389) failed
[ 2514.912373] FAT-fs (sdf1): Directory bread(block 16390) failed
[ 2514.913501] FAT-fs (sdf1): Directory bread(block 16391) failed
$ cd GE[ 2520.571564] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2520.573560] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2520.575570] FAT-fs (sdf1): Directory bread(block 16386) failed
[ 2520.577540] FAT-fs (sdf1): Directory bread(block 16387) failed
[ 2520.579464] FAT-fs (sdf1): Directory bread(block 16388) failed
[ 2520.581348] FAT-fs (sdf1): Directory bread(block 16389) failed
[ 2520.583180] FAT-fs (sdf1): Directory bread(block 16390) failed
[ 2520.585002] FAT-fs (sdf1): Directory bread(block 16391) failed
[ 2520.586242] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2520.587227] FAT-fs (sdf1): Directory bread(block 16385) failed
cd ..
-bash: cd: GEcd: No such file or directory
$ cd ..
$ cd
$ ls /m[ 2535.708028] FAT-fs (sdf1): bread failed in fat_clusters_flush

$ ls /media/owner/08F1-B181/
[ 2543.126034] FAT-fs (sdf1): Directory bread(block 16384) failed
[ 2543.127680] FAT-fs (sdf1): Directory bread(block 16385) failed
[ 2543.129345] FAT-fs (sdf1): Directory bread(block 16386) failed
[ 2543.131001] FAT-fs (sdf1): Directory bread(block 16387) failed
[ 2543.132664] FAT-fs (sdf1): Directory bread(block 16388) failed
[ 2543.133720] FAT-fs (sdf1): Directory bread(block 16389) failed
[ 2543.134689] FAT-fs (sdf1): Directory bread(block 16390) failed
[ 2543.135658] FAT-fs (sdf1): Directory bread(block 16391) failed
$ sudo screendump > err1.txt
$ sudo ./custom_umount.sh
[ 2562.338570] FAT-fs (sdf1): unable to read boot sector to mark fs as dirty

可以做些什麼來檢索我的 U 盤中的數據?有什麼辦法可以格式化這個 U 盤嗎?


為了回答 Giles 的問題,我發布了來自/var/log/kern.log. /dev/sdf1今天早上檢測到我的 USB 。

Apr 10 09:48:57 owner-Inspiron-560s kernel: [  664.264018] usb 2-1: new high-speed USB device number 3 using ehci-pci
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.450207] usb 2-1: New USB device found, idVendor=8564, idProduct=1000
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.450212] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.450216] usb 2-1: Product: Mass Storage Device
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.450220] usb 2-1: Manufacturer: JetFlash
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.450223] usb 2-1: SerialNumber: 49FBA7ASLQLI85XB
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.450505] usb-storage 2-1:1.0: USB Mass Storage device detected
Apr 10 09:48:58 owner-Inspiron-560s kernel: [  664.452264] scsi3 : usb-storage 2-1:1.0
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.625373] scsi 3:0:0:0: Direct-Access     JetFlash Transcend 4GB    1100 PQ: 0 ANSI: 0 CCS
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.625637] sd 3:0:0:0: Attached scsi generic sg6 type 0
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.626204] sd 3:0:0:0: [sdf] 7913472 512-byte logical blocks: (4.05 GB/3.77 GiB)
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.626964] sd 3:0:0:0: [sdf] Write Protect is off
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.626967] sd 3:0:0:0: [sdf] Mode Sense: 43 00 00 00
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.629683] sd 3:0:0:0: [sdf] No Caching mode page found
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.629688] sd 3:0:0:0: [sdf] Assuming drive cache: write through
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.633958] sd 3:0:0:0: [sdf] No Caching mode page found
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.633963] sd 3:0:0:0: [sdf] Assuming drive cache: write through
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.635278]  sdf: sdf1
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.638587] sd 3:0:0:0: [sdf] No Caching mode page found
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.638594] sd 3:0:0:0: [sdf] Assuming drive cache: write through
Apr 10 09:48:59 owner-Inspiron-560s kernel: [  665.638599] sd 3:0:0:0: [sdf] Attached SCSI removable disk
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.577641] usb 2-1: USB disconnect, device number 3
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588035] sd 3:0:0:0: [sdf]  
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588041] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588044] sd 3:0:0:0: [sdf] CDB: 
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588046] Write(10): 2a 00 00 00 00 3e 00 00 01 00
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588059] end_request: I/O error, dev sdf, sector 62
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588064] Buffer I/O error on device sdf1, logical block 0
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588066] lost page write due to I/O error on sdf1
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588596] FAT-fs (sdf1): FAT read failed (blocknr 1042)
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592660] FAT-fs (sdf1): Directory bread(block 16384) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592666] FAT-fs (sdf1): Directory bread(block 16385) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592668] FAT-fs (sdf1): Directory bread(block 16386) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592670] FAT-fs (sdf1): Directory bread(block 16387) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592672] FAT-fs (sdf1): Directory bread(block 16388) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592674] FAT-fs (sdf1): Directory bread(block 16389) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592676] FAT-fs (sdf1): Directory bread(block 16390) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592678] FAT-fs (sdf1): Directory bread(block 16391) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592841] FAT-fs (sdf1): Directory bread(block 16384) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.592843] FAT-fs (sdf1): Directory bread(block 16385) failed
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.726597] FAT-fs (sdf1): FAT read failed (blocknr 960)
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.928055] usb 2-1: new high-speed USB device number 4 using ehci-pci
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114205] usb 2-1: New USB device found, idVendor=8564, idProduct=1000
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114209] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114211] usb 2-1: Product: Mass Storage Device
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114213] usb 2-1: Manufacturer: JetFlash
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114215] usb 2-1: SerialNumber: 49FBA7ASLQLI85XB
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114482] usb-storage 2-1:1.0: USB Mass Storage device detected
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.114531] scsi4 : usb-storage 2-1:1.0
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  671.165582] FAT-fs (sdf1): unable to read boot sector to mark fs as dirty
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.285361] scsi 4:0:0:0: Direct-Access     JetFlash Transcend 4GB    1100 PQ: 0 ANSI: 0 CCS
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.285607] sd 4:0:0:0: Attached scsi generic sg6 type 0
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.289169] sd 4:0:0:0: [sdf] 7913472 512-byte logical blocks: (4.05 GB/3.77 GiB)
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.290238] sd 4:0:0:0: [sdf] Write Protect is off
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.290242] sd 4:0:0:0: [sdf] Mode Sense: 43 00 00 00
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.291531] sd 4:0:0:0: [sdf] No Caching mode page found
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.291535] sd 4:0:0:0: [sdf] Assuming drive cache: write through
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.295714] sd 4:0:0:0: [sdf] No Caching mode page found
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.295718] sd 4:0:0:0: [sdf] Assuming drive cache: write through
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.297077]  sdf: sdf1
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.300147] sd 4:0:0:0: [sdf] No Caching mode page found
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.300151] sd 4:0:0:0: [sdf] Assuming drive cache: write through
Apr 10 09:49:05 owner-Inspiron-560s kernel: [  672.300154] sd 4:0:0:0: [sdf] Attached SCSI removable disk

從核心日誌:

Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588044] sd 3:0:0:0: [sdf] CDB: 
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588046] Write(10): 2a 00 00 00 00 3e 00 00 01 00
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588059] end_request: I/O error, dev sdf, sector 62
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588064] Buffer I/O error on device sdf1, logical block 0
Apr 10 09:49:04 owner-Inspiron-560s kernel: [  670.588066] lost page write due to I/O error on sdf1

這不好:這是硬體錯誤,比文件系統低。fsck有助於解決軟體級錯誤,但無法修復硬體;執行它甚至可能使事情變得更糟,因為它試圖移動數據,但不能因為某些空間無法寫入。

USB記憶棒往往便宜且不可靠。您的某些數據可能已失去。嘗試ddrescue將大部分文件系統恢復到磁碟映像中,但不可讀的扇區可能會永遠失去。我不會嘗試將新數據儲存在經過驗證的壞棒上。

引用自:https://unix.stackexchange.com/questions/275358