Subject: Bogglifying problems

From: Phil Norman <[email-masked]>
Date: Tue, 18 Nov 1997 16:31:40 +0000 (GMT)

Hi!

I'm having a bit of a problem with ext2fs.  Here's what's happened so far:

I've written a program which reads the linux partition table and works 
out what kind of partitions are where on the disc.  This works, and 
agrees with PartMan (though PartMan's calculations of partition/table 
sizes are too small by 1 sector - it assumes 
number_of_sectors=last_sector-first_sector, which is wrong).

I've had a look at ext2fs.h and found that the superblock should first 
appear 1k into the partition, and is defined to be 1k long.

I've dumped the first few sectors off my main linux partition, and 
compared it with the output from 'dumpe2fs', and found a superblock or 
two.  This is all very nice, but here's the problem:

The first superblock I found was a +1.5k exactly, not +1k.  This is 
strange.  The second superblock I found was at +2k, which is even more 
strange since it not only means that that superblock is in the wrong 
place, but the one before it (at +1.5k) is only 512 bytes in length; half 
the length linux defines it to be.  Other than that, BOTH superblocks are 
correct in every detail, and are both updated every time I remount the 
filesystem in linux.  This is the strangest part, since linux obviously 
reads and understands the partition, even though it completely 
contradicts what's in linux's own ext2fs.h file.

I thought that, just maybe, this might be my hard disc being a bit 
strange, so I tried it out with my old 210meg HD (involving taking my RPC 
to pieces, removing the CDROM drive and putting in the small HD leaning 
at approx 30 degrees on top of the larger one ;-).  I formatted this in 
pretty much the same way as the larger one, with a small ADFS partition 
followed by the linux one, and I did exactly the same thing with the 
dumping etc as with the larger HD.  I get exactly the same result with 
that one - the two superblocks being at +1.5k and +2k.

Can anyone shed some light on this area of utter strangeness?  Does linux 
really contradict itself or is it just me being stupid?

Thanks in advance,
Phil

-- 
Phil Norman, mailing from Exeter Uni.
Programs available for download from my web page.
email:  [email-masked]
web:    http://newton.ex.ac.uk/general/ug/norman

---

From: Philip Blundell <[email-masked]>
Date: Tue, 18 Nov 1997 23:01:58 +0000

>appear 1k into the partition, and is defined to be 1k long.

What exactly are you looking at that makes you think this?

>place, but the one before it (at +1.5k) is only 512 bytes in length; half 

512 bytes is one disk block, which sounds a likely size for the superblock to 
be.  I haven't actually looked at the code, but to be honest it sounds likely 
that you're misinterpreting the file.

p.

---

From: Phil Norman <[email-masked]>
Date: Wed, 19 Nov 1997 12:31:29 +0000 (GMT)

> that you're misinterpreting the file.

The superblock size is defined in ext2fs.h, right at the top of the file 
(AFAICR).  It has a comment to the effect that some ppl define it to be 
slightly bigger than this, but they define it to be 1024bytes exactly.