I'm trying to fix a corrupted sdcard vfat filesystem (used in an Android device) using fsck.
The sdcard just stopped working one day (the file browser doesn't show it and it's not visible in Android settings), I tried re-inserting it. When that didn't work I used my sdcard reader on my Linux machine. There I was able to mount and browse the filesystem, but after inserting it into Android it still didn't show up. I inserted it back to my Linux machine and the filesystem was gone (the device was recognized though). So I gave up and used cfdisk to create a new (ext4) partition. After doing that and quitting cfdisk, the previous filesystem (vfat) was recovered and the files could be browsed and viewed. I have no idea what's going on.
Current lsblk and fsck output:
> lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
mmcblk0
├─mmcblk0p1 vfat 6AEE-8592
├─mmcblk0p2 swap bf2ed99b-104e-4a91-8970-b392a19dccc8 [SWAP]
└─mmcblk0p3 ext4 0cdff248-07ef-48aa-8c67-b9c86c6f8aa9 11G 55% /
mmcblk0boot0
mmcblk0boot1
mmcblk1
└─mmcblk1p1 vfat 35B9-1806
> sudo fsck -av /dev/mmcblk1p1
fsck from util-linux 2.34
fsck.fat 4.1 (2017-01-24)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "android "
Media byte 0xf0 (5.25" or 3.5" HD floppy)
512 bytes per logical sector
32768 bytes per cluster
74 reserved sectors
First FAT starts at byte 37888 (sector 74)
2 FATs, 32 bit entries
1930752 bytes per FAT (= 3771 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 3899392 (sector 7616)
482633 data clusters (15814918144 bytes)
16 sectors/track, 4 heads
0 hidden sectors
30896128 sectors total
Reclaiming unconnected clusters.
Checking free cluster summary.
Free cluster summary wrong (189038 vs. really 118813)
Auto-correcting.
Performing changes.
/dev/mmcblk1p1: 1050 files, 363820/482633 clusters
For some reason, fsck returns with exit code 1
> echo $?
1
Repeating the fsck command produces the exact same output.
Is there anything I can do about this or is the SD card dead?
fsck
exit code 1 means that errors were found and corrected. See linux.die.net/man/8/fsck.