Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 1995 09:58:36 -0400 (EDT)
From:      John Capo <jc@irbs.com>
To:        kallio@jyu.fi (Seppo Kallio)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: ** How to add second SCSI disk ? **
Message-ID:  <199508171358.JAA00763@irbs.irbs.com>
In-Reply-To: <v01530505ac58e3052f0a@[130.234.41.39]> from "Seppo Kallio" at Aug 17, 95 03:15:23 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Seppo Kallio writes:
> 
> >Trivial as long as you understand that fdisk is broken.
> 
> Here some instructions how to do this trivial thing (add one more disk
> using DOS fdisk, FreeBSD fdisk, disklabel -e):
> 
> 1. As long as the FreeBSD fdisk does not find correct geometry of SCSI disks
>    make in DOS a whole disk size partition (if possible) into the disk
> 
> 2. Start FreeBSD and
>    # fdisk -i /dev/sd1         # Assuming your disk is at address 1 in SCSI bus
> ******* Working on device /dev/sd1 *******
> parameters extracted from in-core disklabel are:
> cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl)
> 
>  Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl)
> 
> Do you want to change our idea of what BIOS thinks ? [n] n
> 
> Answear n, this should be no correct if you did some partition in DOS.
> 
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 0 is:
> sysid 6,(Primary 'big' DOS (> 32MB))
>     start 32, size 165856 (80 Meg), flag 0
>         beg: cyl 0/ sector 1/ head 1;
>         end: cyl 80/ sector 32/ head 63
> Do you want to change it? [n]
> 
> I do not know about the warning ...
> 
> But everything should be now OK.
> 
> Answear y, you have to correct the sysid it is 165 for FreeBSD
> 
> And you will get:
> 
> Supply a decimal value for "sysid" [0] 165
> Supply a decimal value for "start" [0] 32
> Supply a decimal value for "size" [0] 165856 <<<<<---- 163840 (80 * 32 * 64)
> Explicitly specifiy beg/end address ? [n] n
> sysid 165,(FreeBSD/NetBSD/386BSD)
>     start 32, size 165856 (80 Meg), flag 0
>         beg: cyl 0/ sector 1/ head 1;        <<<<<---- 0/1/0
>         end: cyl 80/ sector 32/ head 63      <<<<<---- 79/32/63
> Are we happy with this entry? [n] y
> 

It looks like you are trying to create an 80MB FreeBSD partition.
Why so small?

Fdisk is broken.  It does not calculate the proper ending addresses.
You should also be using the raw device /dev/rsd0.  Answer y when
fdisk asks:

Explicitly specifiy beg/end address ? [n] y
Supply a decimal value for "beginning cylinder" [0] 
Supply a decimal value for "beginning head" [0] 
Supply a decimal value for "beginning sector" [0] 1
Supply a decimal value for "ending cylinder" [0] 79
Supply a decimal value for "ending head" [0] 63
Supply a decimal value for "ending sector" [0] 32

Cylinder and head addressing is from 0 - n.  Sector addressing is
from 1 - n.  For this 80MB partition, the start C/H/S should be
0/0/1.  The end C/H/S should be 79/63/32.

If you are trying to use the entire disk for FreeBSD, the start
C/H/S is 0/0/1 and the end C/H/S is 1922/63/32.  The variable that
holds the cylinder parameter is only 8 bits.  When fdisk shows you
the partition, the cylinder will be 898, not 1922 that was entered.

> Now it is correct, partition 1-3 are unused
> 
> The data for partition 1 is:
> <UNUSED>
> Do you want to change it? [n] n
> The data for partition 2 is:
> <UNUSED>
> Do you want to change it? [n] n
> The data for partition 3 is:
> <UNUSED>
> Do you want to change it? [n] n
> 
> Do you want to change the active partition? [n] n
> We haven't changed the partition table yet.  This is your last chance.
> parameters extracted from in-core disklabel are:
> cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl)
> 
>  Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=1923 heads=64 sectors/track=32 (2048 blks/cyl)
> 
> Information from DOS bootblock is:
> 0: sysid 165,(FreeBSD/NetBSD/386BSD)
>     start 32, size 165856 (80 Meg), flag 0
>         beg: cyl 0/ sector 1/ head 1;
>         end: cyl 80/ sector 32/ head 63
> 1: <UNUSED>
> 2: <UNUSED>
> 3: <UNUSED>
> Should we write new partition table? [n] y
> 
> Now everything sould be correct. Answear y.
> 
> I am getting
> 
> ioctl DIOCWLABEL: Operation not supported by device

This is from using the block device rather than the raw device.

> 
> But it seems that the partition is correct.
> 
> 2. Start disklabel -e /dev/sd1
> Yu will get this kind of screen:
> 
> # /dev/sd1:
> type: unknown
> disk:
> label: koe
> flags:
> bytes/sector: 512
> sectors/track: 32
> tracks/cylinder: 64
> sectors/cylinder: 2048
> cylinders: 1923
> sectors/unit: 167301           <<<<<<<----- This is BOGUS
> rpm: 0
> interleave: 0
> trackskew: 0
> cylinderskew: 0
> headswitch: 0           # milliseconds
> track-to-track seek: 0  # milliseconds
> drivedata: 0
> 
> 3 partitions:
> #        size   offset    fstype   [fsize bsize bps/cpg]
>   c:   167301        0    unused        0     0         # (Cyl.    0 - 81*)
> 
> 
> Thats it. What then?
> I cannot go forward
> 

I have never used the -e option.  I always build a disklabel in
/etc/disktab and use

    disklabel -w -r sd1 label_name

where label_name is an entry in /dec/disktab.

The -e option looks like it will let you create the label with an
editor.  I just tried it on my -current system and the system hung.  :-(

If you are running 2.0.5 or later, partition c is the entire FreeBSD
partition.  Partition d is no longer special and can be used for
a file system.  Release 1.1.5.1 and earlier both c and d partitions
are special.  Partition b is a swap partition.  The default device
in fdisk is still /dev/rwd0d.

Here are three entries for /etc/disktab for an 80MB partition and
for the full disk.

# 80MB
disk1|Whatever Type Of Disk This Really Is: \
	:dt=SCSI:ty=winchester:se#512:nt#64:ns#32:nc#80:\
	:pa#163840:oa#0:ba#8192:fa#1024:ta=4.2BSD:\
	:pc#163840:oc#0:

# 1923MB  with one file system
disk2|Whatever Type Of Disk This Really Is: \
	:dt=SCSI:ty=winchester:se#512:nt#64:ns#32:nc#1923:\
	:pa#3938304:oa#0:ba#8192:fa#1024:ta=4.2BSD:\
	:pc#3938304:oc#0:

# 1923MB  with two file systems and swap space in the middle
disk2|Whatever Type Of Disk This Really Is: \
	:dt=SCSI:ty=winchester:se#512:nt#64:ns#32:nc#1923:\
	:pa#1903616:oa#0:ba#8192:fa#1024:ta=4.2BSD:\
	:pb#131072:ob#1903616:tb=swap:\
	:pc#3938304:oc#0:\
	:pd#1903616:od#2034688:bd#8192:fd#1024:td=4.2BSD:

Once you have a label on the disk you have to create the file
systems with newfs.  Run newfs -t 0 -u 0 sd1X for each of your file
system partitions where X is a, d, e, f, g, or h.  The -t 0 -u 0
arguments tell newfs to use the track and sector info in the label
rather than the compiled in defaults.

Hope this helps.

John Capo
IRBS Engineering




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