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:
- How to mount windows drives in Ubuntu
- How to Mount an ISO Image?
- 'IPCS' command in Linux with examples
- select command in Linux with examples
- Sed Command in Linux/Unix with examples
- ZIP command in Linux with examples
- SORT command in Linux/Unix with examples
- Cat command in Linux with examples
- Head command in Linux with examples
- Tail command in Linux with examples
- wc command in Linux with examples
- tar command in Linux with examples
- atrm command in Linux with examples
- bc command in Linux with examples
- AWK command in Unix/Linux with examples
- tr command in Unix/Linux with examples
- mv command in Linux with examples
- Paste command in Linux with examples
- comm command in Linux with examples
- cmp 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 email@example.com. 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.