Read
Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
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|dirmount [-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:
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!
Last Updated : 23 May, 2019
Like Article
Save Article
Share your thoughts in the comments