Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 1995 03:31:41 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.org
Cc:        bde@zeta.org.au
Subject:   Re: cvs commit: src/sys/scsi sd.c
Message-ID:  <199503231731.DAA22454@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
I have committed the the changes for slices to the sd driver:
---
bde         95/03/23 08:09:02

  Modified:    sys/scsi sd.c
  Log:
  Support disk slices.  This involves mainly replacing inline code with
  function calls.  Broken tracking of open partitions gets fixed as a side
  effect.  Races in sdopen() and sdioctl() become more numerous than before.
  
  Close the device in sdsize().  Media removal could not have worked right
  when unused swap devices were held open.  There may now be a problem
  with used swap devices not being held open.
  
  Fix ancient operator precedence bug in sddump().  It may have been
  possible to attempt dumping to unloaded media.
  
  Remove NetBSD ifdefs.  We're too different now, and the NetBSD driver was
  already too different for them to be relevant.
  
  Remove support for soft write protection.  There are no ioctls to set it,
  and this driver never set it either.  It was used in the wd driver to
  disable writing to unlabelled disk, but we want to support writing to
  foreign partitions on unlabeled disks.
  
  Clean up some formatting and restore some old-style function headers.
---

This should not affect the operation of normal BSD partitions sd0[a-c],
sd0[e-h], rsd0[a-c] and rsd0[e-h] (all examples assume drive 0).  The
d partition should become available as a normal partition.  The whole
disk can be accessed as device sd0 or rsd0 instead.  Use MAKEDEV to
create these devices if you don't already have them.  Programs that
want to access the d partition may break.  There aren't many such
programs - only fdisk and sysinstall.  sysinstall breaks, but
`fdisk /dev/rsd0' should work.

There will be some new boot messages such as the following:

sd0s1: start 32, end = 262143, size 262112: OK
sd0s2: start 262144, end = 1816575, size 1554432: OK
sd0s3: start 1816576, end = 2078719, size 262144: OK
sd0s5: start 1816608, end = 2078719, size 262112: OK
sd1s1: start 32, end = 524287, size 524256: OK
sd1s2: start 524288, end = 1572863, size 1048576: OK
sd0s1: start 32, end = 262143, size 262112: OK
sd0s2: start 262144, end = 1816575, size 1554432: OK
sd0s3: start 1816576, end = 2078719, size 262144: OK
sd0s5: start 1816608, end = 2078719, size 262112: OK
[messages not related to slices...]
sd0s1: start 32, end = 262143, size 262112: OK
sd0s2: start 262144, end = 1816575, size 1554432: OK
sd0s3: start 1816576, end = 2078719, size 262144: OK
sd0s5: start 1816608, end = 2078719, size 262112: OK

sd0s1 is an MSDOS partition.  I use a line "/dev/sd0s1 /dosC msdos ..."
in /etc/fstab to mount this.  If you have an MSDOS partition in the
disklabel, then you should see additional messages about the partition
not being valid because it is not within the slice and the partition
should be replaced by one of size 0 and any reference to it in
/etc/fstab should stop working.  These problems may be fixed by
editing the label and /etc/fstab.  The on-disk label isn't changed
automatically.  Run MAKEDEV to create new slices if necessary.

sd0s2 is a FreeBSD slice.  The first BSD slice is aliased to slice 0
and `s0' is not present in the names for slice 0.  This allows you
to use the old names and device inodes.  You may wire down the
slice number by never using the slice 0 alias.  Run `MAKEDEV
sd0s2h' to create the partitions for sd0s2.

sd0s3 is an extended DOSpartition.  Extended DOSpartitions contain
further extended DOSpartitions and slice and are not suitable for
holding file systems.  Slices are only created for primary extended
DOSpartitions.

sd0s5 is a logical MSDOS drive within sd0s3.  There may be up to 26
slices of any type within extended DOSpartition(s).  There may be
multiple FreeBSD slices, but currently, booting is only supported from
the first slice, the boot slice must be a primary DOSpartition, and
fdisk doesn't support slices within extended DOSpartitions.  Run
`MAKEDEV sd0s5' to create the non-default slice sd0s5.

sd1s1 is a DOS slice.

sd1s2 is a FreeBSD slice.

The messages for sd0 are repeated twice because the partition table
and labels are reread whenever a sliced disk device is opened when
there are no current opens on it, and devices sd0 is opened and
fully closed several times while booting.  This wart is currently
required for rereading the changed partition tables.  It also
helps debug partition tables and disk labels.  If sd0 is the root
device, then after root is mounted the messages for sd0 should
never be seen again.  Mounting and unmounting sd1a would cause
lots of messages.

The procedure for putting partition tables and labels on disk is
not much changed from before.  It is best practiced on the vn
device.  The main new points are that sd0d is no longer the whole
disk (this affects fdisk) and slices in /etc/disktab must be
relative, i.e., the c partition must start at 0, and all the
partitions must fit in the slice.  If there are no DOSpartitions,
then slice 0 is supposed to be the whole disk.  Note that boot
blocks contain a bogus DOSpartition table so you will have to
do some work to reach this pure state.  The whole-disk device
sd0s1 has an in-core-only read-only label.  fdisk will print
a warning when it can't write this label.

I found old mail giving examples of some more error messages:

>>sd0: rejecting partition in BSD label: it isn't entirely within the slice
>>sd0e: start 32, end 262143, size 262112

>I still have a slice for a DOS primary partition on 'e' for backwardsness.
>The message omits the position of the slice because it was printed
>immediately above.

>>sd1: raw partition size != slice size
>>sd1: start 6144, end 825343, size 819200
>>sd1c: start 6144, end 823963, size 817820

The messages may have changed slightly since then.

Bruce



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