Last modified: Nov. 7, 2013
Contents
1 - Summary
2 - Device information
3 - Create partition
4 - Format partition
5 - Mount partition
6 - Modify fstab
1 - Summary
This guide will show how to add a new hard drive in FreeBSD. It explains how
to partition, format and mount a UFS2 partition. This has been tested in
FreeBSD 9.0.
2 - Device information
Find the device information. In our example, it's da0.
# sysctl kern.disks
kern.disks: da0 cd0 ada1 ada0
da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
da0: <ST2000VX 000-1CU164 CV22> Fixed Direct Access SCSI-5 device
da0: 40.000MB/s transfers
da0: 1907729MB (3907029168 512 byte sectors: 255H 63S/T 243201C)
3 - Create partition
Create a partition. We will create a UFS partition.
# gpart show -l da0
gpart: No such geom: da0.
# sudo gpart create -s gpt da0
Password:
da0 created
# sudo gpart add -t freebsd-ufs da0
Password:
da0p1 added
# gpart show -l da0
=> 34 3907029101 da0 GPT (1.8T)
34 3907029101 1 (null) (1.8T)
4 - Format partition
Format the partition.
# ls -1 /dev/da0*
/dev/da0
/dev/da0p1
# sudo newfs -U -O 2 /dev/da0p1
Password:
5 - Mount partition
Create a mount point and mount the partition.
# sudo mkdir /backups
Password:
# sudo mount /dev/da0p1 /backups
Password:
# df -h /backups/
Filesystem Size Used Avail Capacity Mounted on
/dev/da0p1 1.8T 1.6G 1.7T 0% /backups
6 - Modify fstab
Finally, modify /etc/fstab for the new partition. If it's a USB drive, you can
modify /etc/rc.local to mount it on startup.
|