*BSD News Article 53481


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!uwm.edu!chi-news.cic.net!newsfeed.internetmci.com!howland.reston.ans.net!Germany.EU.net!zib-berlin.de!irz401!uriah.heep!not-for-mail
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: help on labeling non-labeled new scsi disk
Date: 21 Oct 1995 12:12:24 +0100
Organization: Private FreeBSD site, Dresden.
Lines: 92
Message-ID: <46akio$ge6@uriah.heep.sax.de>
References: <461btt$34q@overload.lbl.gov> <462cgf$hgc@germany.eu.net> <463hk0$pde@overload.lbl.gov>
NNTP-Posting-Host: uriah.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Jin Guojun[ITG] <jin@gracie.lbl.gov> wrote:

>Also, the right syntax
>for MAKEDEV is :
>	./MAKEDEV sd[0-9]
>Thanks for your point.

Both are valid, "sh MAKEDEV args..." is also ok.

>Now, what is fairly obvious is that disklabel is buggy

It's fairly obvious that disklabel ain't buggy, and it's as obvious
that you didn't read the slices.hlp file on the boot floppy. :-)

If something is buggy (or at least, dubious), it's fdisk(8).

>Now, switch nl-disk to sd0 and sd1, and l-disk to sd2 and sd3; then
you will see

># disklabel: /dev/rsd0c: No such file or directory
>
>and disklabel -r sd2 will work well. So, don't doubt the system is wrong.

What's wrong with "disklabel [options] sd2"?  Why don't you simply
trust disklabel(8) to find the right device, and try to enforce it
something it cannot access (yet) -- "/dev/rsd0c"?

The idea of which device is the "control" device to use for labelling
a disk has been shifted away from the implicit "c" partition.  The "c"
partition abstraction is still handled by the driver for compatibility
with old software, but it's apparently not usable to label a disk, and
you should also expect it to go away some day.  (The implicit "d"
partition that has been around since 386BSD 0.1 did already go away.)

Which device would be the correct one does indeed -- as Bernhard
remarked in his reply -- depend on whether you've got a "sliced" disk
(ie., there are fdisk partitions -- "slices" -- around for compat-
ibility with other systems), or whether you're thinking in the Unix
tradition where Unix owns the entire disk.  I prefer the latter, but
that depends on your environment.

Some examples:

/dev/rsd0.ctl		- control device for raw SCSI access, e.g.
			  low-level formatting

/dev/rsd0		- the entire disk; the only valid device to
			  run fdisk(8) on; the only valid device to
			  run disklabel(8) on when using a non-sliced
			  disk

/dev/rsd0s1		- the entire first slice of a sliced disk (i.e.,
			  the first fdisk partition as mentioned in the
			  fdisk table); need not be a *BSD slice, i.e.
			  an MSDOG partition can also be mounted through
			  this device; the only valid device to run
			  disklabel(8) on when using a sliced disk (of
			  course, only on an 0xa5 slice)

/dev/rsd0a		- the first (`a') partition of either the entire
			  disk (non-sliced disk), or of the "compatibility"
			  slice (sliced disk).  The compat slice is the
			  first entry in the fdisk table having a system
			  ID of 0xa5.  This is not necessarily the first
			  entry of the fdisk table at all, nor does it
			  imply an location on the *disk*, only a location
			  in the *fdisk table*.  Note that the bootstrap
			  can currently only boot off the compat slice
			  (or the entire disk).

/dev/rsd0s3b		- the second (`b') partition of slice 3, which
			  must be a *BSD slice (0xa5); partition `b' is
			  usually used for swapping

/dev/rsd0s1c		- the `c' partition of slice 1; this is still
			  maintained as an alias for the entire slice
			  for backwards compatibility, however, it's
			  only valid on a labelled disk/slice

Note that the slice code will print an "invalid partition table: no
magic" warning whenever you're accessing a disk where the first sector
doesn't end up in 0x55aa.  In case of a non-sliced disk, you can
ignore this warning.  Should you wish to get rid of it, simply put a
FreeBSD bootstrap on it, e.g. with "disklabel -B -r [-w] sd0 ...".

Btw., the installer doesn't use disklabel(8) itself; it uses libdisk
which can be found in the src/release/libdisk directory.
-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)