Adding a new unformatted drive to an existing machine

WARNING, WARNING, WARNING

If you are not confident about what you are doing here (i.e. know what FreeBSD's concept of a slice, partition are and how drive numbering and device naming work) you should probably not try this. If the slice you are installing on is a different one or if the drive is actually wd, etc. you need to know enough about the above to adjust the commands below appropriately.


Note from 10/99 D. Ott, Modified by F. Hernandez 1/00

We found the following steps to work when installing new disks on dirt and moorthy. I suspect they would work on all our FreeBSD machines.

  1. Run /stand/sysinstall. Choose post-installation config. Choose fdisk. Choose the new drive. Choose "A" for all and answer whatever else follows. Choose "W" for write. Then "Q" for quit. Now exit /stand/sysinstall. (You must exit here, using the "Cancel" button several times.)
  2. Run /stand/sysinstall again. (This loads the new label). Choose post-installation config. Choose label. Using "C", create an appropriate partition(s), for example "playpen1". Now choose "W" which will put a new ufs on the disk and then mount it. Exit /stand/sysinstall. At this point, you can test the new disk which will be mounted on your system.
  3. Manually add the "playpen4" disk mount entry to /etc/fstab using a text editor. Cut and paste the "/var" entry, and change the "Device" and the "Mountpoint" fields. Find out the device name by running "df", that will show the device name for the new partition in the "Filesystem" column. For instance,
    foghorn (/net/buzzard/dirt/fhernand)$ df
    Filesystem                       512-blocks     Used    Avail Capacity  Mounted on
    /dev/wd0s1a                          254302    59180   174778    25%    /
    /dev/wd0s1f                        11073610  1551656  8636066    15%    /usr
    /dev/wd0s1e                          254302     9938   224020     4%    /var
    /dev/wd1s1e                        19418438        2 17864962     0%    /playpen1
    procfs                                    8        8        0   100%    /proc
    buzzard.cs.unc.edu:/playpen          823070   716770    24000    97%    /net/buzzard/playpen
    buzzard.cs.unc.edu:/smithfd         3905146  2508674  1005972    71%    /net/buzzard/smithfd
    tyagi137.cs.unc.edu:/usr           16408972 10718886  4377370    71%    /net/tyagi137/usr
    buzzard.cs.unc.edu:/jeffay2         4352724  1268526  2648938    32%    /net/buzzard/jeffay2
    buzzard.cs.unc.edu:/dirt-playpen   17411002   439798 15230104     3%    /net/buzzard/dirt-playpen
    buzzard.cs.unc.edu:/dirt-bulk       3905146  3169590   345056    90%    /net/buzzard/dirt-bulk
    buzzard.cs.unc.edu:/dirt            7879208  5727788  1363500    81%    /net/buzzard/dirt
    
    The device name for partition "/playpen1" is "/dev/wd1s1e". The modified /etc/fstab file will be:
    foghorn (/net/buzzard/dirt/fhernand)$ cat /etc/fstab       
    # Device                Mountpoint      FStype  Options         Dump    Pass#
    /dev/wd0s1b             none            swap    sw              0       0
    /dev/wd0s1a             /               ufs     rw              1       1
    /dev/wd0s1f             /usr            ufs     rw              2       2
    /dev/wd0s1e             /var            ufs     rw              2       2
    /dev/wd1s1e             /playpen1       ufs     rw              2       2
    /dev/wcd0c              /cdrom  cd9660  ro,noauto       0       0
    /dev/wdc1               /zipdos         msdos   rw,noauto       0       0
    proc                    /proc           procfs  rw              0       0
    
  4. Reboot and confirm that the new disk is mounted and works okay.

On michigan I installed as per the instructions below. They seemed to work fine, except that disk devices were named da0s1, da1s1, etc.


Notes from the 2.2.2 handbook on how to do this - Note the notes in the more recent versions don't tell you how to do it this way.


To get the 2nd drive (playpen1) on goldberg to work I had to
manually label it and put a FS on it.  

First I tried to do this with /stand/sysinstall using the partition
editor (FDISK) and the label editor but it always failed when I tried
to write the partition information.  However, I think it may have done
some of the basic labelling so you may want to give it a whirl to get
you part way there.

After I failed in /stand/sysinstall and I tried to mount and got some
message about a bad boot block I looked at the Handbook page above.  

I generated two disk label outputs.  One of the disk I needed to work
on, sd1, and one of a disk that seemed to be set up the way I wanted
this one.  In this case they were both on the same machine (sd2 was the other) so I did:

/sbin/disklabel -r /dev/sd1s1 > /tmp/diskproto.sd1
/sbin/disklabel -r /dev/sd2s1 > /tmp/diskproto.sd2

The output of each was:

diskproto.sd1:
==============
# /dev/sd1s1:
type: SCSI
disk: sd1s1
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 1109
sectors/unit: 17832087
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]
  c: 17832087        0    unused        0     0       	# (Cyl.    0 - 1109*)

and

diskproto.sd2:
==============
# /dev/sd2s1:
type: SCSI
disk: sd2s1
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 1109
sectors/unit: 17832087
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]
  c: 17832087        0    unused        0     0       	# (Cyl.    0 - 1109*)
  e: 17832087        0    4.2BSD        0     0     0 	# (Cyl.    0 - 1109*)


The only difference is the addition of the line for the e: partition.  So, I used

/sbin/disklabel -e sd1

to edit the disklabel for sd1 and add that line.

I then checked it with:

/sbin/disklabel -r /dev/sd1s1

and it matched what I wanted.

Finally, I had to create the newfs on the "e" slice:

/sbin/newfs /dev/rsd1s1e

This takes a few minutes.

Then I added a line like:

/dev/sd1s1e             /playpen1       ufs     rw              2       2

to /etc/fstab and did:

/sbin/mount /playpen1 

and it works!


Other DiRT documents
Author: Mark Parris Last updated: January 9, 1999