Casi todos los administradores de sistemas nos ha pasado alguna vez que hemos borrado la particion de LVM equivocada, la buena noticia es que no todo esta perdido, usando el comando 'vgcfgrestore' podemos rescatar la particion de LVM que acabamos de borrar. Linux guarda una copia de la configuracion del LVM dentro de el directorio /etc/lvm/archive .
ejecutando el comando vgcfgrestore --list LVM-GROUP-NAME podemos obtener una lista de las copias hechas por el sistema vm cada vez que hacemos algun cambio,
[root@localhost]# vgcfgrestore --list storage
File: /etc/lvm/archive/storage_00059-1279792267.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/www-backup'
Backup Time: Thu May 1 01:25:14 2013
File: /etc/lvm/archive/storage_00062-473822267.vg
VG name: storage
Description: Created *before* executing '/sbin/lvcreate -L3G -s -n ns1-backup /dev/storage/ns1'
Backup Time: Thu May 1 01:48:44 2013
File: /etc/lvm/archive/storage_00063-1908990772.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/ns1-backup'
Backup Time: Thu May 1 01:53:06 2013
File: /etc/lvm/archive/storage_00065-149387914.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/www-backup'
Backup Time: Fri May 2 01:25:17 2013
File: /etc/lvm/archive/storage_00069-762515257.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/ns1-backup'
Backup Time: Fri May 2 01:52:48 2014
File: /etc/lvm/archive/storage_00071-258460846.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/www-backup'
Backup Time: Sat May 3 01:25:16 2013
File: /etc/lvm/archive/storage_00074-717607964.vg
VG name: storage
Description: Created *before* executing '/sbin/lvcreate -L3G -s -n ns1-backup /dev/storage/ns1'
Backup Time: Sat May 3 01:48:34 2013
File: /etc/lvm/archive/storage_00075-510499646.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/ns1-backup'
Backup Time: Sat May 3 01:52:46 2013
File: /etc/lvm/archive/storage_00075-710999646.vg
VG name: storage
Description: Created *before* executing '/sbin/lvremove -f /dev/storage/ns1'
Backup Time: Sat May 3 10:14:04 2013
Para recuperar la confiuracion como estana "ANTES" de ejecutar '/sbin/lvremove -f /dev/storage/ns1' el dia Sat May 3 10:14:04 2013 podemos ejecutar:
[root@localhost]# vgcfgrestore -f /etc/lvm/archive/storage_00075-710999646.vg storage
[root@localhost]# lvchange -a y /dev/storage/ns1
Aqui vemos la particion ha sido /dev/storage/ns1 restaurada.
[root@localhost]# lvdisplay /dev/storage/ns1
--- Logical volume ---
LV Path /dev/storage/ns1
LV Name ns1
VG Name storage
LV UUID Elqx0f-EB4y-O2LJ-BnJ1-Zokp-rd5q-DHsdP7
LV Write Access read/write
LV Creation host, time bk1.servervirto.com, 2014-04-22 16:54:12 -0400
LV Status available
# open 0
LV Size 10.00 GiB
Current LE 320
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2