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

Dave Cinege (
Wed, 11 Jun 97 15:39:14 -0500

On Wed, 11 Jun 1997 15:20:41 -0400 (EDT), Grant R. Guenther wrote:

>> 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.

This is what I figured......I've yet to sit down and actully write anything
for linux so I wouldn't know where to begin. By the time I shit!

Just had an idea....if I dd the partitions to /dev/null it should give me
the size of each! I believe they are spaced 63 sectors apart from that
point, so I should be able to work from the end of the drive back....

What I was saying, is it would take me more time to write that program then
back everything up, repartition, and restore.

>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.

I thought of this, but the data is not worth the work. Basically everything
is from a virgin install and set-up so it is a matter of how much time I can

My new dd idea should work. Will take a little time, but it will work.
I was hoping someone would say "Look here in proc" or "This new version of
fdisk will print that info"

That info really should be available somehow at the user level.....

Elite MicroComputers 908-541-4214