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:
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 |
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 |
mkdir /data
To mount device /dev/ad1s1d on /data/ directory, type:
mount /dev/ad6s1d /data |
mount /dev/ad6s1d /data
Verify new mounted file system either with df command or mount command:
mount df -h |
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 |
umount /data/
### verification ##
df -H
mount
(adsbygoogle = window.adsbygoogle || []).push({});