Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 1998 20:53:06 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.ORG, julian@FreeBSD.ORG
Subject:   Re: DEVFS-11
Message-ID:  <199801080953.UAA03260@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>You can now newfs /dev/rsd0 and mount it (/dev/sd0) without ever
>disklabelling it. (its just a pile of blocks, why not have a FS on it?)

This has been easy since slices were introduced in 2.0.5.  It requires
a simple trick to bypass a bug in newfs:

	# ln -s /dev/rsd0 /tmp/rsd0c
	# newfs /tmp/rsd0c

This makes newfs use the 'c' partition described by the in-core label
for /dev/rsd0.  The bug is that newfs attempts to use the 'a' partition
if the device pathname ends with a digit.  It should use 'a' + RAW_PART.
disklabel(8) is more careful about this, and only uses 'a' on tahoes.

This is not so easy for /dev/rsd0s1 in -current.  Old methods for
newfs'ing an unlabeled device must be used (see below).  Slices are
not given an in-core label be default, on purpose so that label ioctls
can be used to determine if a slice really has a label, and so that it
is harder to corrupt foreign slices by writing back a label that seems
to exist.  This was a mistake (at least BSD slices should be given an
in-core label), but no one complained so I didn't fix it.

Old methods for newfs'ing an unlabeled device or file:

1. The same method as is used for floppies:

	put an entry `foo' for the device in /etc/disktab
	(including an 'a' partition to avoid the newfs bug)
	# newfs -T foo /dev/rsd0

2. A variation that works for all disk devices that _don't_ have labels:

	put an entry `maximum' for the device in /etc/disktab
	(like the `minimum' entry but with a few billion sectors)
	and give the disk size explicitly in the newfs command
	# newfs -s NNN -T maximum /dev/rsd0s1

This doesn't work right if /dev/rsd0s1 has a label - then the label is
used and /etc/disktab is not consulted.

3. (2) even works even better for regular files (they can never have a
label :-):

	# cp /dev/null /dev/z0	# newfs will extend it
	# newfs -s 20480 -T maximum /tmp/z0

mount(8) and fsck(8) don't have any limitations in this area (device
independence).  fsck even works on regular files.

Bruce



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