[TriLUG] how to restore lvm data
Dave Hostetler
hostetler.david at gmail.com
Wed Apr 14 09:44:16 EDT 2010
+1 for testdisk I once used this to restore a data partition that I accidentally deleted and it worked great.
Dave
On Apr 14, 2010, at 2:48 AM, Maxwell Spangler wrote:
> On Tue, 2010-04-13 at 20:43 -0400, Ralph Blach wrote:
>> Ok, I made a bad mistake. I accidentally deleted the partion table for
>> a disk but the linux box still has the lvm data on it.
>>
>> However system config lvm does not show a /dev/sdc where the lvm's are
>> located.
>> is there a way to recover /dev/sdc to show so that the lvm's are shown
>> on /dev/sdc
>
> I'm working with LVM study over here and used my test disk to duplicate
> and resolve your problem.
>
> In my case I had a single 300GB maxtor drive with four partitions, two
> of which (#1 and #3) were in use as part of a single volume group called
> vg_maxtor.
>
> I deleted each of those partitions to duplicate your situation.
>
> Running # vgscan produced errors related to being unable to read disk
> blocks from a device-mapper device dm-1.
>
> I rebooted to further simulate the environment you described.
>
> Then I downloaded testdisk (http://www.cgsecurity.org/wiki/TestDisk) and
> ran that.
>
> Testdisk let me select the physical drive being used for testing and
> scan it from start to finish to find missing partitions. It easily
> found partitions 1 and 3 and let me write a new partition table
> identical to the setup before this experiment.
>
> I then ran # partprobe to let the kernel rescan for hard drive
> partitions and in this case, it succeed. Sometimes you just have to
> reboot (and testdisk suggests this.)
>
> Running # vgscan again with the partitions recovered found the vg_maxtor
> volume group.
>
> Next I re-activated the volume group with the vgchange command:
>
> # vgchange -a y
>
> Then I was able to mount the two logical volumes containing ext4
> filesystems that were contained within this volume group.
>
> Please let us know if this process works for you. I hadn't known how to
> do this before and just learned it on the fly as part of studying LVM2,
> so I enjoyed the opportunity.
>
> --
> Maxwell Spangler
> ========================================================================
> Linux, Unix and Database Administration
> Currently: Boulder, Colorado
> LinkedIn: http://www.linkedin.com/in/maxwellspangler
>
>
>
> --
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ : http://www.trilug.org/wiki/Frequently_Asked_Questions
More information about the TriLUG
mailing list