add recover-softraidlvm
This commit is contained in:
parent
5087d70932
commit
ae3bbe38be
|
@ -1,100 +0,0 @@
|
|||
Title: Recover Softraid/LVM
|
||||
Date: 2012-02-06 10:24
|
||||
Slug: recover-softraidlvm
|
||||
|
||||
MD Array fails to assemble
|
||||
--------------------------
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<figure class="code">
|
||||
<figcaption>
|
||||
<span>Find the Problem</span>
|
||||
|
||||
</figcaption>
|
||||
<div class="highlight">
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| ``` {.line-numbers} | #?/bin/shcat /proc/mdstatmdadm - |
|
||||
| 12345 | D --scanmdadm -E --scanmdadm -E /dev |
|
||||
| ``` | /sd[abcdef]1 |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
</div>
|
||||
|
||||
</figure>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<figure class="code">
|
||||
<figcaption>
|
||||
<span>Try to assemble manually</span>
|
||||
|
||||
</figcaption>
|
||||
<div class="highlight">
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| ``` {.line-numbers} | #?/bin/shmdadm --stop /dev/md{0, |
|
||||
| 123 | 127}mdadm --assemble /dev/md0 /dev/s |
|
||||
| ``` | d{a,b,c,d,e,f}1 --force |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
</div>
|
||||
|
||||
</figure>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<figure class="code">
|
||||
<figcaption>
|
||||
<span>recover a failed device in the array</span>
|
||||
|
||||
</figcaption>
|
||||
<div class="highlight">
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| ``` {.line-numbers} | #?/bin/shmdadm /dev/md0 --re-add |
|
||||
| 123456 | /dev/sdx1 # will likely failmdadm - |
|
||||
| ``` | -zero-superblock /dev/sdx1 # reap th |
|
||||
| | e deviceecho 200000 > /proc/sys/dev/ |
|
||||
| | raid/speed_limit_min # speed up reco |
|
||||
| | verymdadm /dev/md0 --add /dev/sde1sl |
|
||||
| | eep 56000 && echo "FINISHED!" |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
</div>
|
||||
|
||||
</figure>
|
||||
</p>
|
||||
|
||||
Recover LVM after doing something stupid
|
||||
----------------------------------------
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<figure class="code">
|
||||
<figcaption>
|
||||
<span>Restore VolGroup Partitioning</span>
|
||||
|
||||
</figcaption>
|
||||
<div class="highlight">
|
||||
|
||||
+--------------------------------------+--------------------------------------+
|
||||
| ``` {.line-numbers} | #?/bin/sh# imagine you did somet |
|
||||
| 123456789 | hing like 'vgremove vg'vgdisplay -v |
|
||||
| ``` | # > logical volume: empty :(# lvm st |
|
||||
| | ores backup of partitioning, yayvgcf |
|
||||
| | grestore -f /etc/lvm/archive/vg_0001 |
|
||||
| | 8-2146062166.vg -v vgvgchange -ayvgd |
|
||||
| | isplay -v # > logical volume: files1 |
|
||||
| | e2fsck /dev/vg/files1mount /dev/vg/ |
|
||||
| | files1 |
|
||||
+--------------------------------------+--------------------------------------+
|
||||
|
||||
</div>
|
||||
|
||||
</figure>
|
||||
</p>
|
||||
|
62
content/posts/recover-softraidlvm.rst
Normal file
62
content/posts/recover-softraidlvm.rst
Normal file
|
@ -0,0 +1,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
|
Loading…
Reference in a new issue