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 or 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?
swapoff -a
and then retryfsck -f /dev/sda5
. If that doesn't work, you may have to give fsck the lvm name like /dev/ubuntu-vg/root. Uselvmdiskscan
to see the names.