Recover Softraid/LVM

Mon 06 February 2012
By makefu

MD Array fails to assemble

Find the Problem

cat /proc/mdstat
mdadm -D --scan
mdadm -E --scan
mdadm -E /dev/sd[abcdef]1

Trying to assemble manually

mdadm --stop /dev/md{0,127}
mdadm --assemble /dev/md0 /dev/sd{a,b,c,d,e,f}1 --force

recover a failed device in the array

mdadm /dev/md0 --re-add /dev/sdx1 # will likely fail
mdadm --zero-superblock /dev/sdx1 # reap the device
echo 200000 > /proc/sys/dev/raid/speed_limit_min # speed up recovery
mdadm /dev/md0 --add /dev/sde1
sleep 56000 && echo "FINISHED!"

Recover LVM after doing something stupid

Restore VolGroup Partitioning

# imagine you did something like 'vgremove vg'
vgdisplay -v # > logical volume: empty :(
# lvm stores backup of partitioning, yay
vgcfgrestore -f /etc/lvm/archive/ -v vg
vgchange -ay
vgdisplay -v # > logical volume: files1
e2fsck /dev/vg/files1
mount /dev/vg/files1