Subject: Re: Strange behaviour of NetBSD partitions
To: Uwe Lienig <Uwe.Lienig@fif.mw.htw-dresden.de>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-i386
Date: 09/03/2002 21:23:36
On Tue, Sep 03, 2002 at 03:00:36PM +0200, Uwe Lienig wrote:
> [...]
> After having a running system I wanted to use the 4GB disk (sd1, that is
> actually target 4 on the scsi-bus). First I fdisk'ed the disk. Now I have the
> following partition table:
>
> $ > fdisk /dev/rsd1a
> NetBSD disklabel disk geometry:
> cylinders: 3712 heads: 21 sectors/track: 107 (2247 sectors/cylinder)
>
> BIOS disk geometry:
> cylinders: 522 heads: 255 sectors/track: 63 (16065 sectors/cylinder)
>
> Partition table:
> 0: sysid 169 (NetBSD)
> start 0, size 8388315 (4095 MB), flag 0x0
> beg: cylinder 0, head 0, sector 1
> end: cylinder 521, head 254, sector 63
> 1: <UNUSED>
> 2: <UNUSED>
> 3: <UNUSED>
I wouldn't make the partition start at 0 but one cylinder later:
start 63 size 8388252.
The first cylinder is somewhat special. It can lead to troubles if you have
a disklabel partition starting at 0.
>
> The first partition covers the whole disk. I wanted to use the whole disk! o.k.
>
> Lets disklabel the disk. After disklabel'ing the disk I have:
>
> $ > disklabel -r /dev/rsd1a
> # /dev/rsd1a:
> type: SCSI
> disk: ST15150N
> label: fictitious
> flags:
> bytes/sector: 512
> sectors/track: 107
> tracks/cylinder: 21
> sectors/cylinder: 2247
> cylinders: 3712
> total sectors: 8388315
> rpm: 3600
> interleave: 1
> trackskew: 0
> cylinderskew: 0
> headswitch: 0 # microseconds
> track-to-track seek: 0 # microseconds
> drivedata: 0
>
> 8 partitions:
> # size offset fstype [fsize bsize cpg/sgs]
> a: 262144 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 116*)
> b: 524288 262144 swap # (Cyl. 116*- 349*)
> c: 8388315 0 unused 0 0 # (Cyl. 0 - 3733*)
> d: 7601883 786432 4.2BSD 1024 8192 16 # (Cyl. 349*- 3733*)
>
> Up to now everything is fine! But after creating new file systems
Don't use d. d is reserved on i386: it's the raw partition (like c on other
systems. d is the whole disk and c is the NetBSD part of the disk).
>
> $ > newfs /dev/rsd1a
> ... and
> $ > newfs /dev/rsd1d
>
> I get the following error when trying to mount the second file system:
>
> mount -t ffs /dev/rsd1a /mnt1
> mount -t ffs /dev/rsd1d /mnt2
>
> right after the mount of /mnt2 the console shows the message:
>
> Sep 3 05:02:56 myhost /netbsd: /dev/sd1d: file system not clean (fs_clean=4);
> please fsck(8)
>
> If I mount the file systems in reverse order the other file system complains.
>
> Then I tried to fsck a newfs'ed /dev/rsd1a after the file systems on both
> netbsd-partitions have been created. The fsck bombs with:
>
> $ > fsck /dev/rsd1a
> ** /dev/rsd1a
>
> CANNOT READ: BLK 7588032
> CONTINUE? [yn]
>
> If I only create the /dev/rsd1a everything is ok. But that's a __NO GO__ !
All this is because of the special meaning of d. When you use d, despites what
the disklabel says, it starts at 0, so a and d steps each others.
--
Manuel Bouyer <bouyer@antioche.eu.org>
--