Recover Softraid/LVM #################### Date: 2012-02-06 10:24 :tags: mdadm, softraid, lvm MD Array fails to assemble ========================== Find the Problem ---------------- .. code-block:: bash #?/bin/sh cat /proc/mdstat mdadm -D --scan mdadm -E --scan mdadm -E /dev/sd[abcdef]1 Trying to assemble manually --------------------------- .. code-block:: bash #?/bin/sh 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 ------------------------------------ .. code-block:: bash #?/bin/sh 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 ----------------------------- .. code-block:: bash #?/bin/sh # imagine you did something like 'vgremove vg' vgdisplay -v # > logical volume: empty :( # lvm stores backup of partitioning, yay vgcfgrestore -f /etc/lvm/archive/vg_00018-2146062166.vg -v vg vgchange -ay vgdisplay -v # > logical volume: files1 e2fsck /dev/vg/files1 mount /dev/vg/files1