how to add a drive to a FreeBSD installation
September 16th, 2007 (as amended)

This procedure details how to add a hard disk to an existing FreeBSD installation. I had a spare drive, I wanted to install it so I could cd to it, make directories, copy files to it, etc.

  1. install hard drive into the computer (ensure to set jumpers correctly)
  2. ensure BIOS can see the drive correctly
  3. boot FreeBSD
  4. login as root
  5. run dmesg
  6. note the devicename given to the new drive - it should be visible at the end of the dmesg output (eg. ad1)
  7. create a mountpoint for the new drive (eg. mkdir /mnt/ad1)
  8. (optional) to see the existing partitions on the drive, run fdisk devicename (eg. fdisk /dev/ad1)
  9. run sysinstall
  10. select Configure, then select Fdisk
  11. from the drive selection menu, select the drive to work with (the devicename noted earlier will be listed here)
  12. press A to erase all existing partitions and allocate all the space to FreeBSD
  13. press W to write the new partition table to the disk (NOTE: all existing data on the drive will be lost at this point!) [accept warning if prompted]
  14. press Esc to select None - leave MBR untouched (unless you have reasons for doing otherwise)
  15. press Q, then select OK to quit Fdisk
  16. press Esc to exit the drive selection menu
  17. select Label
  18. press C to create a new FreeBSD slice
  19. define the size of the slice (press Enter to accept the default maximum size)
  20. select FS (filesystem)
  21. specify the mountpoint for the new drive made earlier (eg. /mnt/ad1) - this is the path to the new drive, created earlier
  22. press W to write the slice to disk [accept warning if prompted]

    Note: if you do not see newfs format the slice, and/or you get an 'unable to write' message, repeat this step. When successful, a file called ".snap" should be visible in the root of the drive.
  23. press Q to quit the label editor
  24. press Esc, Esc, and Esc to exit back to the command prompt

The drive will then be available for use, in /mnt/ad1. It will also be listed in the output of the df command.