Recovering LVM from disk image

By: | Comments: No Comments

Posted in categories: Computer Tips, Work related

For a RAID NAS box, when the NAS box dies, the data on the drives are still intact. They can be retrieved in the following steps:

  1. dd disks containing LVM to hard drive; # create images of hard drives
  2. losetup /dev/loopx disks.img; # make images appear as loop devices on OS
  3. partx -v -add /dev/loopx; # make partitions on the loopback devices available to OS
  4. vgscan, vgimport -a; # to import Virtual Groups
  5. vgdisplay; # showing imported VG names
  6. vgchange -a y vgname; # to activate VG
  7. fsck /dev/mapper/vgname; # to check file system of VG
  8. fuseext2 -o ro -o sync_read /dev/mapper/vgname /mounting_point; # to mount the VG
  9. rsync -av –progress /mounting_point/ /destination/

Then you will get everything at your destination, and then you can safely remove the images.

Be the first to comment!

Leave a Reply