Re: *Help!* Where is device partition info stored by the kernel?

Grant R. Guenther (grant@knot.torque.net)
Wed, 11 Jun 1997 15:20:41 -0400 (EDT)


> Where does the kernel keep the partition info? I looked all in /proc and
> couldn't find it.

There's an array indexed by the minor number inside each block device
driver. Look for the fields "start_sect" and "nr_sects" in the source of
the driver in question.

> The system HAS NOT been rebooted. I can still mount all of my partitions,
> but the second it goes down everything will vanish. The kernel still knows
> the old (correct) layout, or else it would not be mounting things. Where is
> it hidden?

There's probably a better solution, but at worst you could write a little
program to use the BLKGETSIZE ioctl to extract the _size_ of each
partition, and then deduce the layout from that.

As a backup solution, you might use dd to capture the first physical
block of each of the lost partitions. Take a cksum of each of them,
then you can devise some offline method of searching for blocks
on the disk that have that cksum.

--------------------------------------------------------------------------
Grant R. Guenther grant@torque.net
--------------------------------------------------------------------------