Problem with LVM partitions
I have been using LVM partitions on my Open SUSE 11.0 machine for a while now.... But on a fine day, when booting the system, all i get is the following error:
Code:
Reading all physical volumes, This may take a while.... My knowledge is limited to setting up of LVM.... Any idea why the error occurs?? I am pretty sure its not an HDD error... There is more than 200 GB of data.... Is there any way to recover without losing data??? Thanx in advance |
Looks to me like the drive isn't being seen on boot up. Does the BIOS see it?
|
I don't know SuSE, but in Redhat and Fedora all of the LVM information is kept in /etc/lvm/.
In mine, I have: Code:
[root@athlonz lvm]# ll Code:
devices { My system has archive and backup files: Code:
[root@athlonz lvm]# ll archive/ files and if so, look within those files to see if the UUID is listed in one of the entries. That'll give you a idea of the device (partition) that is in question. You could try: 'pvscan -u -vvv | less' to show you what devices it is scanning, etc. 'vgscan -vvv | less' to show you what it is doing to assemble the volume groups. Have you tried a 'vgchange -ay' to see what it does? 'vgchange --test --partial -ay' is safe to do, to. (If you are in a shell, you may need to preceed each command with lvm, eg. 'lvm pvscan -u -vvv') |
Also, it didn't occur to me to ask. Did you have any hardware changes? I assume no, since you didn't mention any.
|
Quote:
I have two hard disks, one in which windows is installed (a few partitions from the disk are part of LVM) and the other disk in which Linux is installed.... Both the hard disks can be booted which means that the HDD is ok.... |
Now it seems that two of my logical volumes root and data are missing...
How could that happen??? This is bad.... all my data is also missing now... None of the files in archive or backup has any entry corresponding to the missing LV root or data.... this is a nightmare!!! Is there any way to recover de data??? |
If the drive seems healthy physically, then there is some corruption of LVM's metadata.
You should do an "vgscan -vvv 2>&1 | less" (sorry my earlier advice was missing the redirect of stderr, 2>&1). Make sure that all of your devices and partitions that are part of LVM show up there. If you can't find what is missing and correct it, as a last resort you can activate the volume groups with missing physical volumes by doing "vgchange --partial -ay", and then, of course, mount them with "mount -a". You may get lucky and if all the extents of your logical volumes are available, you'll be able to access the data and move it elsewhere, back it up, or whatever. But correcting the problem would be preferable... |
Another idea. This may be easier. Try:
vgcfgbackup system -f system_vm_info grep iUDlO-VLkW-4fYN-u3cX-C0zR-lw4f-c7b8Eh system_vm_info If grep finds the UUID, then less system_vm_info and search for the UUID with /iUDlO-VLkW-4fYN-u3cX-C0zR-lw4f-c7b8Eh |
Well the root filesystem was also part of the lvm that crashed..... so i have nothing to work on.... no config files or anything.... had it been the normal partition n not an lvm.... would have been a lot better
Are there any LVM recovery tools????? Since i dont have the root file systen is re installation the only way?? But that would make me lose all data.... i am hopeful that the data is physically intact in the HDD now... so i would like to re install only if there is no other way |
You may be able to come up in rescue mode. I'm not sure how it's done in SuSE.
I've done it in Redhat and Fedora and been able to fix LVM problems (like removing a volume physically before removing it from LVM...) In Fedora, you boot the installation CD and do a rescue instead of an install. Since rescue uses busybox instead of the normal commands, you do an 'lvm pvscan', 'lvm vgscan', 'lvm lvdisplay', 'lvm vgchange -ay --partial' rather than a 'pvscan,. 'vgscan', etc. If you are unfamiliar with rescue, put in another post to get some advise from SuSE aware folks. |
Problem solved with no data loss.... :D
Thanx tommylovell for helping me out in those unknown territories.... :) Well i ll describe the steps i took so that it maybe of some help to people with similar problem. It seems that the problem was created by a corrupted metafile (as tommylovell pointed out) and also because of a corrupted partition table.... Well after experimenting with the lvm backup and archive files...... it was completely screwed :( It meant that i had no metafile with my current valid lvm settings (partly because my root partition was part of the LVs that crashed), i could nt even get the initial error i discussed here (missing physical volume) So i needed a metafile to get me started.... After spending a little time on google, i found that if you don't have a backup, you can re-create the equivalent of an LVM2 backup file by examining the LVM2 header on the disk and editing out the binary stuff. LVM2 typically keeps copies of the metadata configuration at the beginning of the disk, in the first 255 sectors following the partition table in sector 1 of the disk. See /etc/lvm/lvm.conf and man lvm.conf for more details. Because each disk sector is typically 512 bytes, reading this area will yield a 128KB file. LVM2 may have stored several different text representations of the LVM2 configuration stored on the partition itself in the first 128KB. Extract these to an ordinary file as follows: Code:
dd if=/dev/sdb3 bs=512 count=255 skip=1 of=/etc/lvm/backup/system Code:
vi /etc/lvm/backup/system Code:
system { Code:
[root@recoverybox ~]# vgcfgrestore -f system system Backing Up Recovered Volume Group Configuration Code:
[root@teapot-new ~]# vgcfgbackup But this was no end to my problems.... however all this did bring me back to my initial problem of missing physical volume..... something like this: Code:
Since i dont like fdisk too much i just used the windows disk manager to create an ntfs partition with the plan to convert it to ext3 later in linux..... having created the ntfs partition, i now had /dev/sda7 partition On booting back to linux i was surprised to see that the ntfs partition i just created was taken as a LVM system (i have no idea why that happened.... it was not even a linux partition....hopefully somebody could explain that) Anyway all my data is fine n i am the happiest man in the world ;) Well if the odd acceptance of an ntfs partition had nt taken place, Use pvcreate to restore the metadata: Code:
pvcreate --uuid "<UUID of missing partition>" --restorefile /etc/lvm/backup/backup <PhysicalVolume> References: http://www.linuxjournal.com/article/8874 http://tldp.org/HOWTO/LVM-HOWTO/recovermetadata.html Can somebody tell me why the NTFS partition created was accepted by LVM??? Should i change it back to a linux partition at a later stage?? The data is intact as far as i can see...... |
All times are GMT -5. The time now is 06:42 PM. |