-   Linux - Newbie (
-   -   LVM and lost information (

ciwl 01-14-2012 10:46 AM

LVM and lost information

There is a virtual machine Xen (Centos 5.6). Inside was a lvm volume. At some point, a failure of power and the error appears. Launched fchk, fixed a bug. I launched it one more time - fell errors and the system not loading.
Mounted on another virtual machine (also Centos 5.6), tried to rename VG, but the second VM also stop loading (its data is not so critical, it is a test).

Created a third machine, the system disk without lvm, mounted a problem lvm-partition.
It became visible name given partition in the process of renaming on previous VM. Drive with the necessary data, appear to do was not in volume group. Nothing smarter than create a new vg and mount this disk does not come up.

# Vgdisplay
--- Volume group ---
VG Name resquevol
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read / write
VG Status resizable
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 135.00 GiB
PE Size 4.00 MiB
Total PE 34 559
Alloc PE / Size 0 / 0
Free PE / Size 34 559 / 135.00 GiB
VG UUID Qnva3K-DX6q-a3a2-wqIe-QE0D-MQue-vrGLiw

Initialization of logical partitions did, only created with the disk vg /dev/xvdb3
Does this mean that my data is destroyed? If not, how to restore it?

PS sorry for my bad English

mpapet 01-15-2012 03:44 AM

The next step is to check and see if loop has max_part option. (modinfo loop as root) Reload loop with max_part=16.

Then losetup pointing to the troubled disk image.

From there, things get kind of vague for me because I'm not a Xen guy. You need to see if there's a FUSE module to mount the disk image. If there is, then it's pretty easy. Losetup /dev/loop0 /path/to/disk/image. If you did it right, Linux magically detects the partitions and will have a /dev/loop0 device, and another /dev/loop0p1 device Mount /dev/loop0 /mnt/some_dir -o read-about-fuse-module-options. If that doesn't work, try the /dev/loop0p1 device.

Once you get the file system mounted on a loop device, fdisk and testdisk is your best bets. It's in Debian's repo's. That's how easy Debian is.

ciwl 01-15-2012 10:11 AM

Thanks for reply.

I looped my bad partition /dev/xvdc3 to /dev/loop0 , but I get "mount: unknown filesystem type 'LVM2_member'" while trying "mount /dev/loop0 /mnt". Module fuse already loaded


lsmod | grep -i fuse
fuse                  50924  0

mpapet 01-15-2012 12:38 PM


Originally Posted by ciwl (Post 4575108)
Thanks for reply.

I looped my bad partition /dev/xvdc3 to /dev/loop0 , but I get "mount: unknown filesystem type 'LVM2_member'" while trying "mount /dev/loop0 /mnt". Module fuse already loaded


lsmod | grep -i fuse
fuse                  50924  0

If you reinserted the loop kernel module with the option I mentioned, there will be more than one /dev/loop0, probably a /dev/loop0p1. Try mounting it.

If that doesn't work, still lots of options. You can find the ext3/4/ntfs/whatever partition offset in fdisk (fdisk -l /dev/loop0) and then mount it specifying the offest. Lots of examples of using the offset option around. Another option is to run testdisk on /dev/loop0 and see what it finds. I'm pretty confident the partition is not lost. You are going to know more about partitions/disks by the time you find/mount the partition.

Very last ditch effort, create a backup of the entire disk on /dev/loop0. Then losetup /dev/loop1 /path/to/dd-image Try activating the logical volume using /dev/loop1 as the device. This is a bit tricky because you aren't creating a new logical volume. That would rewrite the partition information. You are just changing the device path of an existing LVM. Which is why doing it on a disk image is strongly recommended.

ciwl 01-15-2012 02:36 PM

Many thanks for your help.

The issuse solved in such way: I manually edit vgcfgbackup-file, adding there my lost partition (I looked the way in the another my server with almost same lvm config). Then, I make vgcfgrestore and it works fine - losted partition correctly mounted as ext3 so I could navigate there with standard system tools. Data was corrupted, but it was duplicated about 20 times in different places of the FS so I could find a good one.

All times are GMT -5. The time now is 10:55 PM.