Data recovery from lvm
hi every one...
i have a hdd and 3 partitions (1 with data and 2 empty)due to increased size of my virtual machines one partition, i planned to create volume group with all 3 partitions, so i changed the partition with data to lvm using tool data is fine. After that i mistakenly created a volume group with the partition which has data and then added empty partions to the volume grop.Then i realised i did mistake so i removed the partion with data from the volume group using vgreduce command. after removing it when i try to mount it to get the data, it say's unknow filesystem which means i need to format. Please help me is there any way to get that data back from that lvm.i didn't do any foramt, what i did was created volume group with that partition and again removed it from volume group.. Please help me i have all my virtul machines on it. thank you very much. |
In order to create a VG (Volume Group) you needed to have one or more PV (Physical Volume).
It's difficult to discern from your text, whether or not you initially had a VG with PVs, or just a plain MBR. If it's the former, most of a VG can be restored using the files stored under /etc/lvm. /etc/lvm/backup keeps backups of the "current" state of a VG. /etc/lvm/archive keeps state prior to any VG,LV command, such as lvreduce. One may carefully restore a VG to a prior state using the correct file, editing if needed. However if it's the latter, you previously had an MBR, and you executed pvcreate on a device or partition, you likely overwrote the MBR. The best course in either event is to resore from a backup. If, as I'm guessing, you have no backup, please accurately (detailed), describe the status of your boot table type, partitions, existing PV,VG,LV prior to making your error. |
hi bsd, i found your reply little late, so i had to format it and created new one. my main doubt now is, as you said i created a PV,VG and then i create LV, it's all fine, my point is if i have i increase a the VG size, either i need to add a partition to existing VG or a newly crated PV,using vgexted right? But here my requirement is i don't have free space to create new partition or new PV all i do is i have a partition with some data, so i change the filesystem id to lvm and is there any way to add it to a VG with out data loss.
|
No, you cannot just change the type to lvm.
You have to backup your data! Then you can add the partition to the VG, create and/or extend the LV, and then restore the data. You may add a device or just a partition First you must Code:
eg: pvcreate /dev/sda or pvcreate /dev/sda1 Add the new PV devices(s) to the existing VG Code:
eg: vgextend VGNAME pvname pvname... Grow the LV Code:
eg: lvextend --extents '100%FREE' LVNAME Then you need to grow/or recreate your fs. You didn't mention fs type, but many/most support extend/grow command of some type. Now you can restore the data from backup. This cannot be done in place, with pre-existing data, expecting data to be preserved. |
ya, i realized that we can not add any pv with data to a existing vg, new pv or partion will be used as a raw space to a existing vg to increage the vg, from it we can create lv or incerease existing vg.
Quote:
thank you very much. |
All times are GMT -5. The time now is 08:16 AM. |