Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created June 24, 2012 22:50
Show Gist options
  • Save gerhard/2985357 to your computer and use it in GitHub Desktop.
Save gerhard/2985357 to your computer and use it in GitHub Desktop.
root@freetunes:/tmp# vgcfgrestore --file /etc/lvm/backup/lvm-raid lvm-raid
Restored volume group lvm-raid
root@freetunes:/tmp# vgchange -ay
1 logical volume(s) in volume group "lvm-raid" now active
root@freetunes:/tmp# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
lvm0 lvm-raid -wi-a- 5.46t
root@freetunes:/tmp# e2fsck /dev/lvm-raid/lvm0
e2fsck 1.41.11 (14-Mar-2010)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/lvm-raid/lvm0
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
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 <device>
root@freetunes:/tmp# mdadm --fail /dev/md2 /dev/sda
mdadm: set /dev/sda faulty in /dev/md2
root@freetunes:/tmp# mount -a
root@freetunes:/mnt/tank# lvdisplay
--- Logical volume ---
LV Name /dev/lvm-raid/lvm0
VG Name lvm-raid
LV UUID D7Wj1A-wiJk-NxlM-IDdH-0uM4-aF1r-Fbpjjr
LV Write Access read/write
LV Status available
# open 1 # <<< YEY! VOLUME GOT MOUNTED!
LV Size 5.46 TiB
Current LE 22356
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1536
Block device 251:0
@gerhard
Copy link
Author

gerhard commented Jun 24, 2012

The reason why this wasn't working is because one of the disks has developed bad blocks. I ran badblocks with e2fsck and that fixed the problem, re-adding the disk back into the RAID6 array worked. LVM on the other hand wouldn't mount the logical volume due to those badblocks. I've temporarily removed the bad disk from the raid array and the lv mounted fine.

So how do I make LVM aware of he bad blocks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment