*BSD News Article 75276


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.syd.connect.com.au!gidora.zeta.org.au!not-for-mail
From: bde@zeta.org.au (Bruce Evans)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: disklabel for ST15230N under 2.1.x-RELEASE
Date: 2 Aug 1996 20:16:37 +1000
Organization: Kralizec Dialup Unix
Lines: 87
Message-ID: <4tski5$nsr@godzilla.zeta.org.au>
References: <4tjfo1$o6p@overload.lbl.gov> <4tlus4$c0o@uriah.heep.sax.de> <4tqqdf$l0f@overload.lbl.gov>
NNTP-Posting-Host: godzilla.zeta.org.au

In article <4tqqdf$l0f@overload.lbl.gov>,
Jin Guojun[ITG] <jin@gracie.lbl.gov> wrote:
>In article <4tlus4$c0o@uriah.heep.sax.de>,
>J Wunsch <joerg_wunsch@uriah.heep.sax.de> wrote:
>>
>>The label will be duplicated if you actually copy the entire disk:
>>
>>	dd if=/dev/rsd0 of=/dev/rsd1 bs=64k
>>
>>Of course, this assumes number_of_blocks(sd1) >= number_of_blocks(sd0).
>
>Apperently, it is not.

If the disks have different sizes, then copying the labels will probably
give a bogus label.

>I traced the disklabel and the problem seems to be from SCSI ioctl.
>It makes disklabel failure even with already labeled disks.
>
>***************************** /etc/disktab **************************
>ST15230N|Seagate HAWK 4 Family 4.2GB SCSI:\
>        :dt=SCSI:ty=winchester:se#512:nt#32:ns#64:nc#4094:rm#5411: \ 
>        :pa#8192:oa#0:ta=4.2BSD:ba#4096:fa#512: \
>        :pc#8384970:oc#0: \
>        :pe#8376778:oe#8192:te=4.2BSD:be#4096:fe#512:
>**********************************************************************

This is label is invalid.  It says that the disk size is nt*ns*nc =
8384512, which is inconsistent with the 'c' partition size and the 'e'
partition location.  The disk size must be specified using su# if it
is different from nt*ns*nc.  Even better: don't use /etc/disktab at
all: use

	disklabel /dev/rsd1 >/tmp/foo
	$EDITOR /tmp/foo		# change a few fields
	disklabel -R -r sd1 /tmp/foo

># disklabel sd1
># /dev/rsd1c:
>type: SCSI
>disk: sd0s1
>label: 
>flags:
>bytes/sector: 512
>sectors/track: 32
>tracks/cylinder: 64
>sectors/cylinder: 2048
>cylinders: 4094
>sectors/unit: 8384970
>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]
>  a:     8192        0    4.2BSD        0     0     0   # (Cyl.    0 - 3)
>  c:  8384970        0    unused        0     0         # (Cyl.    0 - 4094*)
>  e:  8376778     8192    4.2BSD        0     0     0   # (Cyl.    4 - 4094*)

Seems OK.

># disklabel -rw sd1 ST15230N
>partition c: partition extends past end of unit
>partition e: partition extends past end of unit

This is because the disktab entry says that the unit has size 8384512.

>" disklabel -e sd1 " works only if a disk has been labeled.
>It fails when changing the partitions.

It only works on labeled disks.

># disklabel -e sd1
>...
>/tmp/EdDk.a014275: 24 lines, 604 characters.
>partition e: partition extends past end of unit
>re-edit the label? [y]: 

Similar errors occur when the label on the disk or the edited version of
it have inconsistent values.  It is possible to create an inconsistent
label by copying a consistent one to a smaller disk.
-- 
Bruce Evans  bde@zeta.org.au