Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Aug 1998 09:32:21 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, freebsd-bugs@FreeBSD.ORG, jin@george.lbl.gov
Subject:   Re: bin/7614: disklabel fails to write labal on scsi disk
Message-ID:  <199808152332.JAA00611@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>} >iss# disklabel -w sd0 st15230n
>} >disklabel: No space left on device
>} >
>} >Is this NCR problem or a general SCSI disklabel problem?
>} 
>} This is a user error (attempting to write a label that specifies a
>} disk size or partition size larger than the slice).  Most likely a
>} label suitable for covering the whole disk combined with a slice
>} *not* covering the whole disk.  The `auto' label only applies to
>} the whole disk.
>
>I am confused here. None of above commands is invoked to do things with
>a slice. No where says sd#s#. This is the same command used for 3.0-SNAP:

disklabel(8) converts sd0 to /dev/rsd0c, which is the 'c' partition on
the compatibility slice.  The compatibility slice is an alias for the
lowest numbered FreeBSD slice on the disk, or if the disk doesn't have
a valid partition table, then the compatibility slice is an alias for
the whole disk slice.  `auto' only works in the latter case.

>eubie# uname -a
>FreeBSD eubie.lbl.gov 3.0-980520-SNAP FreeBSD 3.0-980520-SNAP #0: Thu Jun 11 12:27:04 PDT 1998     root@eubie.lbl.gov:/usr/src/sys/compile/MinMax  i386
>eubie#  disklabel sd2
>disklabel: ioctl DIOCGDINFO: Invalid argument
>eubie# disklabel -rw  sd2 auto
>eubie# disklabel sd2
[...works]

Old versions (older than 980520) permitted disklabel to clobber labels:
----------------------------
revision 1.38
date: 1997/09/16 10:11:49;  author: bde;  state: Exp;  lines: +10 -4
Reject attempts to set an in-core label which says that the "disk"
or a partition is larger than the slice.

Now `disklabel -Brw sdX auto' should fail properly on sliced disks
without partition of type 165, e.g., on zip disks with the factory
default formatting.  Previously it set a bogus in-core label for
the compatibility slice and used this to corrupt the MBR (the slice
has offset 0 and size 0, but setting the label in effect corrupted
its size to nonzero).

`disklabel -Brw sdX auto' already failed properly on normally (not
dangerously dedicated) sliced disks _with_ partition of type 165,
because the compatibility slice has a nonzero offset so the MBR
remained inaccessible when the size was corrupted.

This bug only affected in-core labels.  On-disk labels are checked
carefully when they read and written.
----------------------------

>Does this imply that fdisk did not create a volid slice for disklabel?

Only no slice at all, or one slice covering the whole disk, are valid for
disklabeling the whole disk.

Bruce

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



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