18.2. Adding Disks

Originally contributed by David O'Brien.

This section describes how to add a new SATA disk to a machine that currently only has a single drive. First, turn off the computer and install the drive in the computer following the instructions of the computer, controller, and drive manufacturers. Reboot the system and become root.

Inspect /var/run/dmesg.boot to ensure the new disk was found. In this example, the newly added SATA drive will appear as ada1.

For this example, a single large partition will be created on the new disk. The GPT partitioning scheme will be used in preference to the older and less versatile MBR scheme.

Note:

If the disk to be added is not blank, old partition information can be removed with gpart delete. See gpart(8) for details.

The partition scheme is created, and then a single partition is added:

# gpart create -s GPT ada1
# gpart add -t freebsd-ufs ada1

Depending on use, several smaller partitions may be desired. See gpart(8) for options to create partitions smaller than a whole disk.

A file system is created on the new blank disk:

# newfs -U /dev/ada1p1

An empty directory is created as a mountpoint, a location for mounting the new disk in the original disk's file system:

# mkdir /newdisk

Finally, an entry is added to /etc/fstab so the new disk will be mounted automatically at startup:

/dev/ada1p1	/newdisk	ufs	rw	2	2

The new disk can be mounted manually, without restarting the system:

# mount /newdisk

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <[email protected]>.
Send questions about this document to <[email protected]>.