Subject: ext2fs partition
To: None <tech-kern@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: tech-kern
Date: 02/17/2005 20:07:49
# disklabel wd2
type: ESDI
disk: Maxtor 90432D3  
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 8374
total sectors: 8440992
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

7 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 d:   8440992         0     unused      0     0        # (Cyl.      0 -   8373)
 e:    208782        63 Linux Ext2      0     0        # (Cyl.      0*-    207*)
 f:   7181055    208845 Linux Ext2      0     0        # (Cyl.    207*-   7331*)
 g:   1044225   7389900       swap                     # (Cyl.   7331*-   8367*)
disklabel: boot block size 0
disklabel: super block size 0
# mount /dev/wd2e /mnt
mount_ext2fs: /dev/wd2e on /mnt: incorrect super block
# fsck /dev/wd2e
** /dev/rwd2e
BAD SUPER BLOCK: INCOMPATIBLE FEATURE BITS IN SUPER BLOCK
fsck: /dev/rwd2e: Floating point exception


.. and the reason fsck_ext2fs dumps core is that fs->e2fs_bsize==0, which
makes calculating the bcount in setup.c:calcsb() a bit tricky:
        fs->e2fs.e2fs_bcount = (pp->p_size * DEV_BSIZE) / fs->e2fs_bsize;
and it is set from the e partition of the disklabel:
        fs->e2fs_bsize = pp->p_fsize;

Is there more to a name, or is this saying ext2fs block size = fragment size ?

printlabel.c suggests fsize = pp->p_fsize, bsize = pp->p_fsize * pp->p_frag

fsck_ext2fs gets its label via DIOCGDINFO in ata/wd.c which is created
by wdgetdisklabel -> readdisklabel from subr_disk_mbr.c. As this disk
does have an mbrlabel:

# fdisk wd2
Disk: /dev/rwd2d
NetBSD disklabel disk geometry:
cylinders: 8374, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
total sectors: 8440992

BIOS disk geometry:
cylinders: 525, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 8440991

Partition table:
0: Linux native (sysid 131)
    start 63, size 208782 (102 MB, Cyls 0-13), Active
1: Linux native (sysid 131)
    start 208845, size 7181055 (3506 MB, Cyls 13-460)
2: Linux swap or Prime or Solaris (sysid 130)
    start 7389900, size 1044225 (510 MB, Cyls 460-525)
3: <UNUSED>


how is readdisklabel meant to guess values for fsize & bsize?

Cheers,

Patrick