[lug] testdisk - disk utility for disk problems

Maxwell Spangler maxlists at maxwellspangler.com
Wed Apr 14 16:10:53 MDT 2010


Just found this yesterday while helping someone in North Carolina with
an LVM problem.  In his case, he accidentally deleted a primary
partition containing an LVM and needed to regain access to his data.

Testdisk http://www.cgsecurity.org/wiki/TestDisk is a Linux utility that
allows recovery of various disk related problems like missing
partitions.

On my test system I was able to delete two LVM partitions, reproduce his
environment, then use testdisk to scan the disk, recover the partitions
exactly and restore the LVM's volume groups.  Really easy and a great
tool to have in your toolbox for future problems.

Specifically, the procedure to recover was:

1. rpm install of testdisk
2. run testdisk as root
3. point it to the physical hard drive in question
4. let it scan the drive from start to finish, allowing it to find
partitions
5. write a new partition table out, thus recovering the partitions that
were lost
6. # partprobe (or reboot) to allow the kernel to re-discover recovered
partitions
7. # vgscan to find the volume groups
8. # vgchange -a y      to reactivate the found volume groups
9. # mount..  the lvms on those volume groups

Hope you find this useful,
-- 
Maxwell Spangler
========================================================================
        Linux, Unix and Database Administration
        Currently: Boulder, Colorado
        LinkedIn: http://www.linkedin.com/in/maxwellspangler

        




More information about the LUG mailing list