viernes, agosto 24, 2012

Montar LVM GNU/Linux y Reparar


  • sudo su 
  • instalamos lvm2 
  • aptitude install lvm2 ó yum install lvm2
  • fdisk -l (para verificar que existen lvm)
  • pvscan (escaneo particiones lvm)
  • vgscan (detectar grupos LVM)
  • vgchange -a y (activa los LVM logicos para poder escanearlos)
  • lvscan (para poder ver los volumenes logicos disponibles)
  • crear una carpera en la cual montar el volumen logico.
    • /mnt/volumen1 o /media/volumen1 según el sistema.
para un caso particular es importante que el sistema no monte en el arranque /dev/sales/reports ya que si esta corrupto no permitira autenticar en el sistema.
  • Type root's password
  • Edit the /etc/fstab file
  • Comment out the line with /dev/sales/repor
  • Reboot
Para verificar el estado de los volumenes y comprobar si tenemos errores  
  • cat /proc/partition
  • pvscan
si tenemos errores 
  1. Fortunately, the meta data and file system on the disk that was /dev/sdc are intact.
  2. So the recovery is to just put the disk back.
  3. Reboot the server.
  4. The /etc/init.d/boot.lvm start script will scan and activate the volume group at boot time.
  5. Don't forget to uncomment the /dev/sales/reports device in the /etc/fstab file.
Otra forma de error LVM corrupto.
Solution 1:
  1. Since the disk was never removed, leave it as is.
  2. There were no device UUID errors, so don't attempt to restore the UUIDs.
  3. This is a good candidate to just try restoring the LVM meta data.
  4. Run a file system check on /dev/sales/reports. whit e2fsck /dev/sales/reports
si vgcfgrestore sales falla 
vgcfgrestore sales
  Couldn't find device with uuid '56ogEk-OzLS-cKBc-z9vJ-kP65-DUBI-hwZPSu'.
  Couldn't find all physical volumes for volume group sales.
  Restore failed.
  1. Comparing the output of cat /proc/partitions and pvscan shows the missing device is /dev/sdc, andpvscan shows which UUID it needs for that device. So, copy and paste the UUID that pvscan shows for /dev/sdc.
  2. ls-lvm:~ # pvcreate --uuid 56ogEk-OzLS-cKBc-z9vJ-kP65-DUBI-hwZPSu /dev/sdc
      Physical volume "/dev/sdc" successfully created
    
  3. Restore the LVM meta data
  4. ls-lvm:~ # vgcfgrestore sales
      Restored volume group sales
    
    ls-lvm:~ # vgscan
      Reading all physical volumes.  This may take a while...
      Found volume group "sales" using metadata type lvm2
    
    ls-lvm:~ # vgchange -ay sales
      1 logical volume(s) in volume group "sales" now active
    
  5. Run a file system check on /dev/sales/reports.
  6. ls-lvm:~ # e2fsck /dev/sales/reports
    e2fsck 1.38 (30-Jun-2005)
    /dev/sales/reports: clean, 961/131072 files, 257431/262144 blocks
    
    ls-lvm:~ # mount /dev/sales/reports /sales/reports/
    
    ls-lvm:~ # df -h /sales/reports
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/sales-reports
                         1008M  990M     0 100% /sales/reports
    

Tomado de
http://www.novell.com/coolsolutions/appnote/19386.html
http://hotfixed.net/2011/07/25/montar-particiones-lvm-desde-un-livecd/