0

Background

Last year, while copying large video files of over 600MB using Ctrl-C and Ctrl-V in Window's File Explorer from a desktop to my USB stick, I forgot that my USB stick has only 4GB storage. Since then, it was corrupted.

I tried inserted it into a desktop. It mounted for several seconds, and it dismounted. This repeats a few times, and then it can't be opened.

Problem

Tonight, I attempted to fix my USB stick /dev/sdg1 with fsck. I learnt the command from Question Overflow. It's not mounted when the following commands were being run.

# 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.

Then I observed that /dev/sdg1 is changed to /dev/sdh1, but I didn't touch the USB stick at all.

Here's the information about the type of file system of my desktop and my USB stick. /dev/sda3 and /dev/sda5 are C and D drives respectively. /dev/sda6-8 are for 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"

Last year, I got these output from tty1 using screendump. I observed that the blocks 16384-16391 appear repeatedly.

$ 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

What can be done to retrieve the data in my USB stick? Is there any way to format this USB stick?


In response to Giles' question, I post the output from /var/log/kern.log. My USB is detected as /dev/sdf1 this morning.

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
  • This may be a hardware error rather than a garbled filesystem. Do any errors appear in the kernel logs? – Gilles Apr 9 '16 at 23:37
  • @Gilles I've included errors shown in the kernel log in response to your question. – GNUSupporter 8964民主女神 地下教會 Apr 10 '16 at 2:05
4

From the kernel logs:

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

That's not good: that's a hardware error, at a lower level than the filesystem. fsck helps with software-level errors, but it can't repair the hardware; running it could even make things worse as it tries to move data around, but can't because some of the space can't be written to.

USB sticks tend to be cheap and unreliable. Some of your data is probably lost. Try ddrescue to recover most of the filesystem into a disk image, but unreadable sectors are likely to be lost forever. I wouldn't try to store new data on a proven bad stick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.