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.
mount -t type device dir
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.
- 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.
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.
- Displays information about file systems mounted:
- Mounts file systems:
- Displays version information:
- Unmounts file systems:
- col command in Linux with Examples
- less command in Linux with Examples
- man command in Linux with Examples
- tar command in Linux with examples
- rm command in Linux with examples
- ssh command in Linux with Examples
- wc command in Linux with examples
- for command in Linux with Examples
- ip command in Linux with examples
- fc Command in Linux with Examples
- yes command in Linux with Examples
- rcp Command in Linux with examples
- sum command in Linux with Examples
- bc command in Linux with examples
- arp 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 firstname.lastname@example.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.