Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got a disk with a known problem (I know because dd gags when I try to clone it). But when I boot with a live CD and run fsck on the unmounted partition, I get this:

ubuntu@ubuntu:~$ sudo fsck /dev/sdf1
fsck 1.41.4 (27-Jan-2009)
e2fsck 1.41.4 (27-Jan-2009)
/dev/sdf1: clean, 227091/9625600 files, 12789815/38497756 blocks

a millisecond later. It's hard to believe it's checked out the entire hard drive in a ms.

I'm also not certain whether I should be fsck'ing sdf1 or the entire physical disk sdf. When I try the entire drive:

ubuntu@ubuntu:~$ sudo fsck /dev/sdf
fsck 1.41.4 (27-Jan-2009)
e2fsck 1.41.4 (27-Jan-2009)
fsck.ext2: Device or resource busy while trying to open /dev/sdf
Filesystem mounted or opened exclusively by another program?

Which I don't understand because none of the partitions appear to be mounted (I just booted from a live CD and ran the command).

So my basic question is: How can I get fsck (or a different tool that might work better) to spend more than a millisecond analyzing my problem disk?

share|improve this question

3 Answers 3

up vote 8 down vote accepted

First off, you're right about running fsck on the partition - fsck only works on filesystems, not entire disks. You can get a list of all partitions on the disk with fdisk -l /dev/sdd.

You're filesystem type is probably ext3 (the default in most Linux distros), which means it will usually pass an fsck as long its journal is clean. fsck -f will, as mentioned above, force a full check.

However, if you have read errors on the disk, no amount of fsck will help dd - since dd really doesn't care about the content of the disk.

To get dd to read the disk and continue on read errors, use dd conv=noerror,sync, which will continue on read errors and append null bytes to any block when there is a read error.

After you have finished the backup, you should run fsck -f on the clone to get it up and running again.

Another tip: If you backup the partition to a file, you can loopback mount it with mount -o loop filename.ext3 /mountpoint. Also, say you are cloning a 200G partition to a 500G drive, you can then run resize2fs /dev/sdx1 (where sdx is your new drive, partitioned with a single 500G partition), and the filesystem will be resized to 500G.

Lastly, if the disk is in such a shape that it's giving you read errors, I would advise you to avoid turning the disk off and on until you're finished recovering data. In some failure modes, the disk will at some point simply no longer spin up or fail to be recognized by the OS, and at that point getting data out of the drive becomes quite expensive.

share|improve this answer
I did try "dd conv=noerror,sync", but the resulting cloned disk was unbootable. Which is frustrating, because the boot disk runs fine, fscks fine, but I can't clone it to another disk because the disk has 1 bad block (where there is apparently no data). I seem to be stuck... –  Fred Hamilton Aug 8 '09 at 19:26
Don't forget that there might be other reasons why the disk was unbootable (different disk geometry and MBR / boot loader issues). If you can first confirm that the filesystem on the new disk is OK, then you can boot into the system using the rescue mode from the install CD, updating the GRUB bootloader etc. Ie. first run fsck -f /dev/sdx1, then try to mount the filesystem with mount /dev/sdx1 /mnt - replace the x with the appropriate drive letter. –  Kristian Aug 8 '09 at 19:49
Excellent suggestion, but when I ran fsck -f on the cloned partition I got literally hundreds of errors (illegal blocks in inodes, comression bits set on a filesystem without compression support, bad extended attribute blocks, etc.) before I conceded that the dd clone was totally hosed... Not sure what to do next... I suppose I'll try to just copy all the files over to a clean partition... Thanks anyway. –  Fred Hamilton Aug 9 '09 at 2:01
It's better to use ddrescue (or dd_rescue + dd_rhelp) than dd; it's smarter about handling errors, retrying sectors that got errors. gnu.org/software/ddrescue/ddrescue.html kalysto.org/utilities/dd_rhelp/index.en.html garloff.de/kurt/linux/ddrescue –  freiheit Aug 9 '09 at 5:29
The most thorough disk check (with all fixes automated if possible) for root ext2, ext3 or ext4 partition is executed as follows: (1) boot from rescue media (root partition must be unmounted), (2) run e2fsck -f -cc -D -p. That does forced check with non-destructive read-write check for the media and repairs all found problems that can be safely fixed. It might take a few days for a 2TB HDD... –  Mikko Rantalainen Jan 16 '13 at 8:06

This may not be relevant in your case, but thought I'd mention it anyway:

For a lower-level disk check, you could use the badblocks utility. It goes through a device and reports any bad blocks (it cannot repair anything, of course). It's useful, at least, for verifying whether a disk is physically damaged.

Also, e2fsck can use badblocks to avoid bad blocks being used by a filesystem. From e2fsck manual:

  -c     This option causes e2fsck to use badblocks(8) program to do a  read-
         only scan of the device in order to find any bad blocks.  If any bad
         blocks are found, they are added to the bad block inode  to  prevent
         them from being allocated to a file or directory.  If this option is
         specified twice, then the bad block scan will be done using  a  non-
         destructive read-write test.
share|improve this answer

You want the -f option to fsck (Force checking even if the file system seems clean.)

You should run fsck in single user mode. One easy way to do this without a live cdrom boot is to reboot with the -F option.

shutdown -rF now
share|improve this answer
Thanks, but one question: If I reboot with the -F option using a live CD, how does the live CD know it was supposed to run the check? It's a CD, it has no memory that I'm aware of... –  Fred Hamilton Aug 8 '09 at 17:07
I don't think you need to do that from the live cd. Just boot from the live cd and run fsck on the unmounted partition with the -f (force) option included. OR, you can reboot from your hard disk with shutdown -rF. This will force a fsck before the filesystem is mounted. –  Richard Hoskins Aug 8 '09 at 17:41
Actually, it will do the fsck in single user mode. I've edited my answer. –  Richard Hoskins Aug 8 '09 at 17:45
The -F flag for shutdown is not usually officially documented (see man shutdown and shutdown --help and notice it's not there) so you cannot trust it to work. Sometimes it's a no-op. Officially the only method to scan root partition is to boot from alternative media. –  Mikko Rantalainen Jan 16 '13 at 7:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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