FreeBSD: Mount Hard Drive / Disk Command

How do I mount a hard disk in FreeBSD unix using command line options?

You need to use the mount command to mount local or remote (network based share such as NFS or CIFS) on to the FreeBSD file system tree.

Syntax

The general syntax is as follows:

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements None
Time 2m
mount /dev/adXYZE /path/to/mount/point
Where,
  • /dev/adXZE is actual disk partition name.

Mounting a hard disk on FreeBSD

Use the following command to list all detected hard disks including cdrom and partitions:

egrep 'ad[0-9]|cd[0-9]' /var/run/dmesg.boot

Sample outputs:

ad0: 5120MB  at ata0-master WDMA2
acd0: CDROM  at ata1-master WDMA2
Trying to mount root from ufs:/dev/ad0s1a
ad0: 5120MB  at ata0-master WDMA2
acd0: CDROM  at ata1-master WDMA2
Trying to mount root from ufs:/dev/ad0s1a
ad0: 5120MB  at ata0-master WDMA2
acd0: CDROM  at ata1-master WDMA2
Trying to mount root from ufs:/dev/ad0s1a
ad0: 5120MB  at ata0-master WDMA2
acd0: CDROM  at ata1-master WDMA2
Trying to mount root from ufs:/dev/ad0s1a

The following provides much cleaner output:
# atacontrol list
Sample outputs:

ATA channel 0:
    Master:  ad0  ATA/ATAPI revision 7
    Slave:       no device present
ATA channel 1:
    Master: acd0  ATA/ATAPI revision 4
    Slave:       no device present

On modern FreeBSD server use camcontrol command instead:
# camcontrol devlist
Sample outputs:

    at scbus0 target 0 lun 0 (ada0,pass0)
    at scbus1 target 0 lun 0 (ada1,pass1)

FreeBSD mounting commands

To mount a partition called /dev/ad1s1d at /data, create an empty directory using mkdir command:

mkdir /data

To mount device /dev/ad1s1d on /data/ directory, type:

mount /dev/ad6s1d  /data

Verify new mounted file system either with df command or mount command:

mount
df -h

How do I automatically mount on boot up?

Edit /etc/fstab and append entry as follows so that /dev/ad6s1d get mounted automatically when FreeBSD boots:

/dev/ad6s1d     /data       ufs     rw           2       2

Save and close the file.

Unmount a filesystem on FreeBSD

Use umount command as follows for un mounting an device mounted at /data/:

umount /data/
### verification ##
df -H
mount
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • aaa Jan 26, 2014 @ 10:25

    What I shoud on live cd?
    I can`t it.

  • FreeBSD USER Feb 15, 2015 @ 15:05

    $ atacontrol list
    -bash: atacontrol: command not found

    Great! thanks!

    • FreeBSD Nov 4, 2015 @ 17:18

      camcontrol devlist

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.