Thursday, February 5, 2015

FreeBSD Unix Show Mounted File Systems

I recently switched from MS-Windows server to a FreeBSD Unix server. How can I see list of mounted file systems on a FreeBSD based Unix server using command line options?

The command to view mounted files systems, to mount or add any local devices such USB,DVD/CD or remote file systems such asNFS, SAMBA shares or files is the mount command on a FreeBSD operating systems.


How can I list mounted local and remote file systems?

This will list mounted remote and local file systems, run:
$ mount
Sample outputs:
/dev/ada0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
192.168.1.10:/exports/nas01/data on /mnt/nfs (nfs)
The first field displays the special device such as /dev/ada0p2 or remote file system such as 192.168.1.10:/exports/nas01/data mounted on second field. The second field is the mount point for the file system displayed in the first field. Adding the -v flag will add IDs too:
$ mount -v
Sample outputs:
/dev/ada0p2 on / (ufs, local, journaled soft-updates, writes: sync 3 async 50, reads: sync 1193 async 10, fsid f64cdd52f9f387e7)
devfs on /dev (devfs, local, multilabel, fsid 00ff007171000000)
192.168.1.10:/exports/nas01/data on /mnt/nfs (nfs, fsid 01ff003a3a000000)
If you want to see only a specific file system you would use the -t flag. For example, only show a ufs based mounted file system, enter:
$ mount -t ufs
OR just show a nfs based mounted file system, type:
$ mount -t nfs
Sample outputs:
192.168.1.10:/exports/nas01/data on /mnt/nfs (nfs)

/etc/fstab file

The /etc/fstab contains descriptive information about the various file systems. fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file. To see this file, type:
more /etc/fstab
less /etc/fstab
column -t /etc/fstab
Sample outputs:
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p2 /  ufs rw 1 1
/dev/ada0p3 none  swap sw 0 0
md42     none     swap    sw,file=/root/swap1 0 0  

More on column -t command

The column command formats its input into multiple columns. It is useful to display mounted file systems in a table format:
mount | column -t
Or try:
( printf "Device Mounted On (FileSystem_info)\n" ; mount ) | column -t
Sample outputs:
Fig.01: Freebsd Unix mount command and column -t to display output in a table format.
Fig.01: Freebsd Unix mount command and column -t to display output in a table format.

df command examples

The df command shows statistics about the amount of free disk space on a FreeBSD system:
 
df
 
## Use 1024 byte (1 Kibibyte) blocks rather than the default. ##
df -k
 
## Human-readable outputs ##
df -H
 
Sample outputs:
Filesystem                          Size    Used   Avail Capacity  Mounted on
/dev/ada0p2                          20G     11G    7.5G    59%    /
devfs                               1.0k    1.0k      0B   100%    /dev
192.168.1.10:/exports/nas01/data    1.6T    297G    1.2T    20%    /mnt/nfs
This quick tutorial was contributed by Wendy Michele. Editing by admin. You can too contribute to nixCraft.

0 comments:

Post a Comment