Skip site navigation (1)Skip section navigation (2)
Date:               Tue, 10 Oct 1995 17:12:31 +0000
From:      "Andrew Webster" <awebster@dataradio.com>
To:        Joe McGuckin <joe@ns.via.net>
Cc:        questions@freebsd.org
Subject:         Re: Adding a 2'nd disk
Message-ID:  <199510102114.RAA10876@vhf.dataradio.com>

next in thread | raw e-mail | index | archive | help
> Date:          Tue, 10 Oct 1995 13:29:18 -0700
> From:          Joe McGuckin <joe@ns.via.net>
> To:            support@cdrom.com
> Subject:       Adding a 2'nd disk
> Cc:            questions@freebsd.org

> 
> I have a 2'nd scsi frive that I wish to add to my FreeBSD system.
> It will be unix only - no DOS partitions.
> 
> What is the procedure for getting a label on the disk?
> 
> -joe
> 
Again,

Here is Seppo Kalio's excellent documentation on how to add a second 
disk.


Thanks for everyone who did help me! I hope we did all learn 
something.

I have now done this about 10 times and now I feel I know something 
about it.

I agree with John Capo <jc@irbs.com> that it is trivial after you 
know how
to do it ;-). And I agree that the biggest problem is fdisk. It is 
not
trivial what parameters you have change and how! The disklabel -e -r 
sd1 is
not so hard to use. Nor newfs or mount ;-)


-----------------------------------------------------------------------
Here final (?) text how to do it. Or how I have done it.

In an example here I have 80MB SCSI disk (in a AHA 2940 controller),
FreeBSD 2.0.5R.

You have to start with fdisk (# -lines written by me):

# fdisk -i -u /dev/rsd1
******* Working on device /dev/rsd1 *******
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)

# The cylinder count is nonsence, the disk is 80-81 MB,
# so it should be 80 or 81. Head and sector count OK.
# On all Adaptec controlled disks heads=64 and sectors=32
# The head count has nothing to do with the disk drive hardware
# head count. Same with cylinder and sector count.

Do you want to change our idea of what BIOS thinks ? [n] n

# Wrong cylinder count does not matter, forward!

Warning: BIOS sector numbering starts with sector 1

# This should be: "First sector must be 1"

Information from DOS bootblock is:
The data for partition 0 is:
sysid 165,(FreeBSD/NetBSD/386BSD)

# Sysid you must know it is 165, it is zero when you have empty disk
# Where are the docs about this?

    start 32, size 163840 (80 Meg), flag 80
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 79/ sector 32/ head 63
Do you want to change it? [n] y
Supply a decimal value for "sysid" [0] 165   # FreeBSD = 165
Supply a decimal value for "start" [0] 0     # 0 (32  on bootdisk?)
Supply a decimal value for "size" [0] 163840 # This comes from 
80*32*64
# If bootdisk, you must substract 2048 (=32*64) ?????????
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  # Must be 1 (*
Supply a decimal value for "ending cylinder" [0] 79  # Cylinders 0 to 
79=80
Supply a decimal value for "ending head" [0] 63      # (*
Supply a decimal value for "ending sector" [0] 32    # (*
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 0, size 163840 (80 Meg), flag 0
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 79/ sector 32/ head 63
Are we happy with this entry? [n]

# (* are same to all disks in Adaptec SCSI controllers.
# Ending cylinder is same number as the MB count minus one (here 
80-1)

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 0, size 163840 (80 Meg), flag 0
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 79/ sector 32/ head 63
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Should we write new partition table? [n] y  # if all is correct

# you will get following error message, forget it.

ioctl DIOCWLABEL: Operation not supported by device

# Then start disklabel -e -r sd1

# You will get a screen something like:


------------------------------------------------------------------------
# /dev/rsd1c:
type: SCSI
disk: d80mb
label:
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 80
sectors/unit: 165888
rpm: 3600                     # If this is zero, put here 3600
interleave: 1                 # If this is zero, put here 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0

3 partitions:                 # Uh?
#        size   offset    fstype   [fsize bsize bps/cpg]
  c:   163840        0    unused        0     0         # (Cyl.    0 
- 79)

--------------------------------------------------------------------------

# c: is the whole disk, do not touch it!

# I want to add one 10MB swap to this disk, rest space for files.
# So I write to extra lines (before the c: -line):

  a:   143840    20000    4.2BSD      0     0
  b:    20000        0      swap

# Note: the sum of size fields is a+b=c. The offset is the starting
# block number of the partition. When swap starts from 0 and is
# 20000 blocks then next  partition starts from 20000.
# The extra zeroes on a: line mus be there!

# There it is. Exit from editor, if errors try to correct.

# Next make filesystem:

# newfs /dev/rsd1a
Warning: calculated sectors per cylinder (4096) disagrees with disk 
label (2048)
Warning: 3136 sector(s) in last cylinder unallocated
/dev/rsd1a:     123840 sectors in 31 cylinders of 1 tracks, 4096 
sectors
        60.5MB in 2 cyl groups (16 c/g, 32.00MB/g, 7680 i/g)
super-block backups (for fsck -b #) at:
 32, 65568,

# So some sectors could be defined more .. this terminology is 
awfull:
# Here newfs is speaking about 3136 sectors. In fdisk we define that
# the disk has 32 sectors!
# These must be blocks of 512 bytes, or what are they???? 3136 blocks
# is 1605632 bytes that is 1.6MB. The actual size of my disk is more
# than 80MB, it is about 81 MB.

# And mount it:

# mount /dev/sd1a /mnt
# df
Filesystem       1K-blocks     Used    Avail Capacity  Mounted on
/dev/sd0a            96143    30253    58198    34%    /
/dev/sd0s1f        1404471   741255   550858    57%    /home
/dev/sd0s1e         387503   273317    83185    77%    /usr
procfs                   4        4        0   100%    /proc
kaarna:/home/www   1518207  1310531    86219    94%    /opt/www
/dev/sd1a            59951        1    55153     0%    /mnt

# If you get to this point, you are lucky. It is not easy. The
# fdisk is the hardest part.

Seppo



-----------------------------------------------------------------------
  Andrew Webster   Network Manager / Special Projects
  Dataradio Inc.   200-5500 Royalmount Ave.      TEL: +1 514 737 0020
  Town of Mount Royal, QC, CANADA  H4P 1H7       FAX: +1 514 737 7883
  http://www.dataradio.com              Email: awebster@dataradio.com



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