0

I have a corrupted micro SD card which I accidentally pulled out. I want to search & fix any errors with fsck utility.

$ umount /dev/mmcblk0
$ fsck --help
fsck from util-linux 2.29.2
fsck.ext3: invalid option -- 'h'
Usage: fsck.ext3 [-panyrcdfktvDFV] [-b superblock] [-B blocksize]
        [-l|-L bad_blocks_file] [-C fd] [-j external_journal]
        [-E extended-options] [-z undo_file] device

Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external_journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list
 -z undo_file         Create an undo file

$ fsck /dev/mmcblk0 
fsck from util-linux 2.29.2
exfatfsck 1.2.6
Checking file system on /dev/mmcblk0.
File system version           1.0
Sector size                 512 bytes
Cluster size                128 KB
Volume size                  59 GB
Used space                   25 GB
Available space              35 GB
ERROR: unknown entry type 0x86.
ERROR: cluster 0x111ee of file 'expunged' is not allocated.
Totally 260 directories and 3182 files.
File system checking finished. ERRORS FOUND: 2.

$ fsck -p /dev/mmcblk0
fsck from util-linux 2.29.2
exfatfsck 1.2.6
fsck.exfat: invalid option -- 'p'
Usage: fsck.exfat [-V] <device>

Why is -p option is invalid when it says in help that it is Automatic repair (no questions)? How do I fix my SD card then?

4

Look at the second line of the output in both cases. fsck --help used fsck.ext3 (the default on your system) and displayed the options valid for that tool, but fsck -p /dev/mmcblk0 used exfatfsck since that’s what’s appropriate for your SD card.

Unfortunately exfatfsck can’t repair errors, it can only report them. So run

fsck /dev/mmcblk0

to see if there are any errors; if there are you’ll need some other strategy to repair the file system:

  • use another operating system with tools capable of repairing the file system (Windows?);
  • or on Linux, copy all your files somewhere else and reformat the card.

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.