mount
Files and directories
Usage
sudo mount [device] [mountpoint]Attaches a filesystem to a directory; whatever was already in the mountpoint is hidden rather than deleted and comes back when you unmount.
Common flags
| Flag | Meaning |
|---|---|
| -t | Filesystem type, as in -t ext4 |
| -o | Comma-separated options such as ro, rw, loop, remount |
| -a | Mount everything listed in /etc/fstab |
| -r | Mount read-only |
| --bind | Linux: make an existing directory appear at a second place |
Examples
sudo mount /dev/sdb1 /mntAttaches the partition at /mnt.
sudo mount -o remount,rw /Makes a read-only root writable again (Linux).
mount | column -tLists what is mounted, lined up.
Moving, deleting and finding. Some of these do not ask twice, which is why -i becomes a habit.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does mount do?
Attaches a filesystem to a directory; whatever was already in the mountpoint is hidden rather than deleted and comes back when you unmount.
Q. How do I type it?
sudo mount [device] [mountpoint] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
5 are listed here; the full set is in man mount. This command sits under Files and directories.
Related commands
man page: man mount