Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Oct 2002 03:40:07 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        walt <wa1ter@hotmail.com>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: GEOM question
Message-ID:  <20021016032612.J1662-100000@gamplex.bde.org>
In-Reply-To: <3DAC12B5.1080801@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 Oct 2002, walt wrote:

> Poul-Henning Kamp wrote:
> > In message <3DAAB913.4010407@hotmail.com>, walt writes:
> >
> >>Would the GEOM framework make it feasible to use a DOS-extended/logical
> >>partition for a BSD filesystem?
>
> > We already support that as far as I know, both with and without GEOM
>
> Yes!  The reason I could never make it work is because of an 'error'
> in the man page for newfs:
>
> "Before running newfs the disk must be labeled using disklabel(8)"
>
> Well, disklabel won't work on an extended/logical partition so I
> never actually got as far as newfs until just now.  Turns out that
> newfs works just great without a disklabel on a logical partition.

Um, disklabel works on any slice.  E.g.:

%%%
Script started on Wed Oct 16 03:23:36 2002
ttyv1:root@gamplex:/tmp> fdisk /dev/ad2
******* Working on device /dev/ad2 *******
parameters extracted from in-core disklabel are:
cylinders=1123 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1123 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
    start 63, size 2104452 (1027 Meg), flag 0
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 130/ head 254/ sector 63
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 2104515, size 9189180 (4486 Meg), flag 80 (active)
	beg: cyl 131/ head 0/ sector 1;
	end: cyl 702/ head 254/ sector 63
The data for partition 3 is:
sysid 131 (0x83),(Linux native)
    start 11293695, size 1028160 (502 Meg), flag 0
	beg: cyl 703/ head 0/ sector 1;
	end: cyl 766/ head 254/ sector 63
The data for partition 4 is:
sysid 130 (0x82),(Linux swap or Solaris x86)
    start 12321855, size 273105 (133 Meg), flag 0
	beg: cyl 767/ head 0/ sector 1;
	end: cyl 783/ head 254/ sector 63
ttyv1:root@gamplex:/tmp> disklabel ad2s3
disklabel: ioctl DIOCGDINFO: Invalid argument
ttyv1:root@gamplex:/tmp> disklabel -rw ad2s3 auto
disklabel: cannot open /dev/ad2s3c: No such file or directory
disklabel: auto: unknown disk type
ttyv1:root@gamplex:/tmp> ln /dev/ad2s3 /dev/ad2s3c
ttyv1:root@gamplex:/tmp> disklabel -rw ad2s3 auto
ttyv1:root@gamplex:/tmp> disklabel ad2s3
# /dev/ad2s3c:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 1020
sectors/unit: 1028160
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0		# milliseconds
track-to-track seek: 0	# milliseconds
drivedata: 0

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  c:  1028160        0    unused        0     0       	# (Cyl.    0 - 1019)
ttyv1:root@gamplex:/tmp> exit

Script done on Wed Oct 16 03:25:07 2002
%%%

This puts a label on an unused Linux partition (ad2s3).  I had to create
/dev/ad2s3c because I don't use devfs and this device didn't already
exist.  I used a link instead of MAKEDEV because that is easier.  It is
a historical bug that disklabel wants a 'c' partition.
"disklabel /dev/ad2s3" should work, but bogusly refuses to work for the
"auto" case.

disklabel also works on almost anything that can be read and written to,
given suitable parameters.  E.g.:

%%%
Script started on Wed Oct 16 03:37:13 2002
ttyv2:bde@gamplex:/tmp> cd /tmp
ttyv2:bde@gamplex:/tmp> dd if=/dev/zero of=foo bs=1440k count=1
1+0 records in
1+0 records out
1474560 bytes transferred in 0.101175 secs (14574358 bytes/sec)
ttyv2:bde@gamplex:/tmp> disklabel -rw /tmp/foo floppy
ttyv2:bde@gamplex:/tmp> disklabel /tmp/foo
disklabel: ioctl DIOCGDINFO: Inappropriate ioctl for device
ttyv2:bde@gamplex:/tmp> disklabel -r /tmp/foo
# /tmp/foo:
type: unknown
disk: fd1440
label:
flags:
bytes/sector: 512
sectors/track: 18
tracks/cylinder: 2
sectors/cylinder: 36
cylinders: 80
sectors/unit: 2880
rpm: 300
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0		# milliseconds
track-to-track seek: 0	# milliseconds
drivedata: 0

3 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:     2880        0    unused      512  4096       	# (Cyl.    0 - 79)
  b:     2880        0    unused      512  4096       	# (Cyl.    0 - 79)
  c:     2880        0    unused      512  4096       	# (Cyl.    0 - 79)
ttyv2:bde@gamplex:/tmp> exit

Script done on Wed Oct 16 03:37:56 2002
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021016032612.J1662-100000>