summaryrefslogtreecommitdiffstats
path: root/content/posts/recover-softraidlvm.rst
blob: efc070d00903c1e89274f78785dbabfdfa71d77d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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