how to add a drive to a FreeBSD installation September 16th, 2007
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.
install hard drive into the computer (ensure to set jumpers correctly)
ensure BIOS can see the drive correctly
boot FreeBSD
login as root
run dmesg
note the devicename given to the new drive - it should be visible at the end of the dmesg output (eg. ad1)
(optional) run fdisk devicename see the existing partitions on the drive
run sysinstall
select Configure, then select Fdisk
select the drive to work with (the devicename noted earlier will be listed here)
press A to erase all existing partitions and allocate all the space to FreeBSD
press W to write the new partition table to the disk (all data on the drive will be lost at this point) [accept warning if prompted]
press Esc to select None - leave MBR untouched (unless you have reasons for doing otherwise)
press Q, then select OK to quit Fdisk
select Label
press C to create a new FreeBSD slice
define the size of the slice (press Enter to accept the default maximum size)
select FS (filesystem)
specify a mountpoint (eg. /mnt/ad1) - this is the path to the new drive
press W to write the slice to disk [accept warning if prompted]
press Q to quit the label editor
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.
Notes:
the drive will NOT be automatically re-mounted after a reboot. To auto-mount the
drive at boot, add something like this to /etc/fstab: