Re: Filesystem creation

Riley Williams
2002-05-15T17:52:13Z

Hi Alan.

>> Now you have me puzzled - I don't remember ever having to specify
>> the partition size when running any of the Linux mkfs commands.
>> Perhaps you could remind me what I'm missing please?
>>
>> mke2fs /dev/hda3
>>
>> mkdosfs /dev/hdb2
>>
>> For some reason, both of those commands worked fine earlier today...

> It computes it.

That's the API that I'm aware of, and what I'd prefer to see in ELKS.

> If you need to specify it then its in K and the fdisk data is in
> sectors.

To quote from Lars' email of a few days ago...

Q> I'm trying to run the image "comb" on an IBM PS/2-30. It boots
Q> OK and runs as I expect. But when I try to make a file system on
Q> the harddisk and mount it, I bump into something.
Q>
Q> fdisk reports 773 cyl, 2 heads, 27 sec.
Q>
Q> /dev/bda1 * 0 1 6 1 27 385 1 20520
Q> /dev/bda2 * 0 1 386 1 27 695 80 16740
Q> /dev/bda3 * 0 1 696 1 27 772 80 4158

I've just fed the above parameters into Linux's fdisk and I get the
following display:

Disk /dev/hda: 2 heads, 27 sectors, 773 cylinders
Units = cylinders of 54 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 385 10381+ 1 FAT12
/dev/hda2 * 386 695 8370 80 Old Minix
/dev/hda3 * 696 772 2106 80 Old Minix

By your argument, the "Blocks" column should be displaying the same
numbers in both tables, but the ELKS version displays what looks like
precicely double the number the Linux version reports, at least for
partitions 2 and 3, and it appears to set totally different parameters
altogether for partition 1.

Simple arithmetic shows that the Linux fdisk is displaying actual track
capacities in Kilobytes in the Blocks column in each case, which is
contrary to the API you refer to above.

Alan: Can you explain this please?

Lars continues:

Q> mkfs /dev/bda2 5859 finishes OK, but a following fsck /dev/bda2
Q> produces an error message, fsck: bad magic number in super-block.
Q>
Q> If I reduce the number of blocks by one, to 5858, fsck finishes
Q> without error message.
Q>
Q> Mounting the new fs under /mnt goes OK, but ls /mnt gives error
Q> messages.
Q>
Q> /mnt:
Q> Bad inode number on dev 0302: 3677 is out of range
Q> Bad inode number on dev 0302: 11330 is out of range
Q> (some garbage on this line)
Q>
Q> Trying to repair the fs with fsck -a desn't seem to do any good.
Q>
Q> If I reduce the number of blocks further, down to 5666, I get no
Q> error messages anywhere. Mounting, unmounting, making
Q> directories, copying files seems to work OK.

According to the details provided by the ELKS fdisk, /dev/bda2 has
16,740 sectors, so 8,370 Kilobytes. However, the numbers he's supplying
to mkfs are (a) 5,859, (b) 5,858 and (c) 5,666, all of which are
considerably smaller than 8,370.

According to the details provided by the Linux fdisk analysis of his
settings, /dev/bda2 has 8,370 sectors, so 4,185 Kilobytes. In this case,
the numbers he's supplying are LARGER than this.

According to your comments above, the "expected API" is that the
parameter to mkfs is exactly half the number reported by fdisk.
If so, then ELKS mkfs is NOT following that API at this time.

Alan: Please explain the error in this reasoning, as I can't find it.

Best wishes from Riley.