FreeBSD: Mount Hard Drive / Disk Command

by on July 11, 2000 · 1 comment· LAST UPDATED January 28, 2014

in , ,

How do I mount a hard disk in FreeBSD 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. The general syntax is as follows:
Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
Estimated completion time2m

mount /dev/adXYZE /path/to/mount/point

/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

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
 
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 aaa January 26, 2014 at 10:25 am

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

Reply

Leave a Comment

Tagged as: , , ,

Previous Faq:

Next Faq: