You are not logged in.

#1 2012-10-03 13:50:47

mhtrinh
Member
Registered: 2010-10-06
Posts: 19

[Solved] Restore damaged LVM

Hi,

I got some issue with LVM. I have a VG named VGFix which containt one LV named ArchRoot, which have one partition /dev/sda2. All my Arch Linux is installed in there.
I wanted to migrate the whole VG to a second disk partition /dev/sdb3. I follow the guide here : http://linuxman.wikispaces.com/Moving+a … a+new+disk
I extend my VG, then move the PV /dev/sda2 to /dev/sdb3. It failed because my second disk partition is slightly smaller. So I shrink the LV ArchRoot without any error and I must messed up somewhere because now, when I boot I got this error :

[...]
Activating logical volumes...
   1 logical volume(s) in volume group "VGFix" now active
:: mounting '/dev/mapper/VGFix-ArchRoot' on real root
mount: wrong fs type, bad option, bad superblock on /dev/mapper/VGFix-ArchRoot, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so
You are now being dropped into an emergency shell

I tried to run some fsck by booting with Arch LiveCD on an Usb key. But I got this error :

fsck: fsck.LVM2_member: not found
fsck: error 2 while executing fsck.LVM2_member for /dev/sda2

And also, in the livecd environment, I don't see  my lvm structure, neither /dev/VGFix or /dev/mapper/VGFix-ArchRoot. But still, when I run pvscan or vgdisplay, I get my LVM structure correctly. Now I can't mount my root filesystem to see if there is anything damaged ...

Please help me rescue my Arch. I don't want to reinstall everything :-(

Last edited by mhtrinh (2012-10-04 18:32:56)

Offline

#2 2012-10-04 10:30:14

p0x8
Member
Registered: 2012-09-20
Posts: 67

Re: [Solved] Restore damaged LVM

In the livecd environment you have to manually activate the VG:

root@archiso ~ # vgchange -a

This should give you access to at least /dev/VGFix and, if the LV is still there, to /dev/mapper/VGFix-Archroot also. And the LV seems to be there, at least according to the log you posted.

Maybe you forgot to resize the file system before shrinking the LV? That could mess it up considerably. EXT file systems usually keep multiple copies of the superblock and other important information, so try running a fsck.$fs on /dev/mapper/VGFix-Archroot, where $fs is your file system type.

Offline

#3 2012-10-04 13:13:23

mhtrinh
Member
Registered: 2010-10-06
Posts: 19

Re: [Solved] Restore damaged LVM

Thanks a lot !!! That is it ! I ran "vgchange -a y" and then I managed to see my lvm structure in /dev/
And yes, I made a lvreduce without resizing my ext4 :-p As the system didn't boot and nothing was written on the partition, I extended back my LV and the fsck passed and the system boot as normal.

But still I have something wrong with my partition as fsck find nothing wrong but when I boot on liveCD, I have this error with resize2fs :

resize2fs: /dev/VGFix/ArchRoot: The combination of flex_bg and !resize_inode features is not supported by resize2fs

But this is another story ... I may post a new thread for this.

Thanks again for how to activate LVM ;-)

Offline

#4 2012-10-04 15:34:59

p0x8
Member
Registered: 2012-09-20
Posts: 67

Re: [Solved] Restore damaged LVM

There's nothing wrong with the file system, but for some reason it has the resize_inode feature disabled. And that particular feature can't be enabled with tune2fs. You could try and also disable flex_bg, but that might have unintended consequences.

Offline

#5 2012-10-04 18:28:14

mhtrinh
Member
Registered: 2010-10-06
Posts: 19

Re: [Solved] Restore damaged LVM

Hi,
Yes, I read somewhere on the web that "might have unintended consequences." so I simply create a new LVM structure and "rsync -a" my root, update grub, /etc/fstab and everything work now (^_^)
The original partition, I think I created with gparted so may be that why for some reason the feature is not enabled ? I make my new parition with the classic mkfs.ext4 and the resize_inode feature is present. I tried resize2fs on it and it is ok.

And thanks for all your advices and your time !

Offline

Board footer

Powered by FluxBB