I have a Ubuntu Server installation on a 250Gb HDD. During setup the drive was partitioned using LVM so my data is on /dev/sda5. When it boots and is left idle, disk errors keep appearing just at the login prompt.

I've read that to run fsck I need to boot from the LiveCD and run the command with the drive unmounted (and connected via a USB/SATA lead). I have done this but the drive still seems to be mounted when I try to run fsck, for example:

root@ubuntu:/# fsck.ext3 -nf /dev/sdb5
e2fsck 1.42.13 (17-May-2015)
Warning! /dev/sdb5 is in use.
ext2fs_open2: Bad magic number in super-block
fsck.ext3: Superblock invalid, trying backup blocks...
fsck.ext3: Bad magic number is super-block while trying to open /dev/sdb5

The superblock could not be read or does not describe a valid ext2/ext3/ext4 filesystem.  If the device is valid and it really contains an ext2/ext3/ext4 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 
e2fsck -b 32768 

But when I run:

root@ubuntu:/# e2fsck -b 32768 /dev/sdb5

I am told that /dev/sdb5 is in use and e2fsck cannot continue.

I have tried unmounting the drive both using the LiveCD GUI and umount command but still it won't repair the superblock.

Please can someone advise how I can resolve this?

  • From the Live DVD, try issuing a swapoff -a and then retry fsck -f /dev/sda5. If that doesn't work, you may have to give fsck the lvm name like /dev/ubuntu-vg/root. Use lvmdiskscan to see the names. – heynnema Jan 13 '17 at 15:54
  • Thanks, it sounds so obvious when you say it but I had to pass the lvm name (ubuntu-vg) instead of the partition name (sda5) to fsck and it is now running. – tippers Jan 13 '17 at 16:24

From the Live DVD, issue a swapoff -a and then retry sudo fsck -f /dev/sda5. If that doesn't work (because sda5 is the physical volume), you will have to give fsck the lvm name like /dev/ubuntu-vg/root. Use lvmdiskscan to see the names.

update: sudo fsck -f /dev/ubuntu-vg worked.

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.