Understanding the Linux umount command and Linux mount command options. This post explains about the mount command in Ubuntu.
Mount Command
The mount command mounts a storage device or filesystem, making it accessible and attaching it to an existing directory structure.
mount [-lhV]
mount -a [-fFnrsvw] [-t vfstype] [-O optlist]
mount [-fnrsvw] [-o option[,option]...] device|dir
mount [-fnrsvw] [-t vfstype] [-o options] device|dir
The standard form of the mount command, is mount -t type device dir This tells the kernel to attach the file system found on device (which is of type type) at the directory dir.
If only the directory or the device is given, for example “mount /dir” then mount looks for a mountpoint (and if not found then for a device) in the /etc/fstab file. The –target or –source options to avoid ambivalent interpretation of the given argument. For example “mount –target /mountpoint”
List All The Mounted Filesystems
The listing mode is maintained for backward compatibility only. For more robust and customizable output use findmnt(8), especially in your scripts. Note that control characters in the mountpoint name are replaced with ‘?’.
The following command lists all mounted filesystems (of type type):
mount [-l] [-t type]
The option -l adds labels to this listing.
When No Argument Is Given
If no arguments are given to mount, the list of mounted filesystems is printed.
The file /etc/fstab may contain lines describing what devices are usually mounted where, using which options. The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab.
Mount Commands That Doesn’t Mount Anything
Also note that three forms of invocation do not actually mount anything: mount -h prints a help message; mount -V prints a version string; and just mount [-l] [-t type] lists all mounted file systems (of type type). The option -l adds the (ext2, ext3 and XFS) labels in this listing.
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree. Conversely, the umount command will detach it again.
umount
The umount command “unmounts” a mounted filesystem, informing the system to complete any pending read or write operations, and safely detaching it.
umount [-hV]
umount -a [-dflnrv] [-t vfstype] [-O options]
umount [-dflnrv] {dir|device}...