mount command in Linux with Examples
All files in a Linux filesystem are arranged in form of a big tree rooted at ‘/‘.These files can be spread out on various devices based on your partition table, initially your parent directory is mounted(i.e attached) to this tree at ‘/‘, others can be mounted manually using GUI interface(if available) or using mount command.
mount command is used to mount the filesystem found on a device to big tree structure(Linux filesystem) rooted at ‘/‘. Conversely, another command umount can be used to detach these devices from the Tree.
Syntax:
mount -t type device dir
Other forms:
mount [-l|-h|-V] mount -a [-fFnrsvw] [-t fstype] [-O optlist] mount [-fnrsvw] [-o options] device|dir mount [-fnrsvw] [-t fstype] [-o options] device dir
These commands tells the Kernel to attach the filesystem found at device to the dir.
Note:
- If you leave the dir part of syntax it looks for a mount point in /etc/fstab.
- You can use –source or –target to avoid ambivalent interpretation.
mount --target /mountpoint
- /etc/fstab usually contains information about which device is need to be mounted where.
- Most of the devices are indicated by files like /dev/sda4, etc. But it can be different for certain filesystems. Please refer below for more information.
man mount
Note: It is important to note that we are only discussing the standard form of mount command given as syntax. Different forms are somewhat discussed because it has certain limitations on different kernels.
Some Important Options:
- l : Lists all the file systems mounted yet.
- h : Displays options for command.
- V : Displays the version information.
- a : Mounts all devices described at /etc/fstab.
- t : Type of filesystem device uses.
- T : Describes an alternative fstab file.
- r : Read-only mode mounted.
Examples:
- Displays information about file systems mounted:

- Mounts file systems:

- Displays version information:

- Unmounts file systems:

Recommended Posts:
- ps command in Linux with Examples
- cd command in Linux with Examples
- bc command in Linux with examples
- env command in Linux with Examples
- tar command in Linux with examples
- look command in Linux with Examples
- dir command in Linux with examples
- cpp command in Linux with Examples
- fmt command in Linux with examples
- cal command in Linux with Examples
- top command in Linux with Examples
- mv command in Linux with examples
- last command in Linux with Examples
- tac command in Linux with Examples
- cvs command in Linux with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



