Re: Lost partition table --> Lost 4th PV partition on disk - how to find the partition bounderies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> /dev/hda4 : start= 51277968, size=144093600, Id=8e

I now found the correct starting sector: 51271920

The main clue I needed was the magic /^.{24}LVM2/, thanks for that!

and a friend of me who rewrote your code in python:

code by Michael Gschwanter:
#!/usr/bin/python
import re,sys

isLVM = re.compile("^.{24}LVM2") # This is how the Sector should look like

if __name__=="__main__":
	args = sys.argv
	device = args[1]
	startSector = int(args[2])
	howMuch = int(args[3])
	endSector = startSector + howMuch
	print "Searching for LVM2 on %s. From Sector %d to
%d"%(device,startSector,endSector)

	dev = file(device,"r") # Read only, just for Security
	dev.seek(startSector * 512)
	t = 0
	while t < howMuch:
		sectorData = dev.read(512)
		m = isLVM.search(sectorData)
		if m:
			print "We found the Start sector of the pv at %d\n"%(startSector+t)
			break
		t = t + 1


	dev.close()

Usage:  ./findlvm.py  /dev/<deindevice>   startSector  maximumSectorsToTry

just used the output sector minus one!

Great thanks to all who tried and helped to save my data!!!


Georg


_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux