mount Command Cheat Sheet
The mount command serves to attach the filesystem found on some device to the big file tree.
Synopsis
mount -t type device dir
Basic Mounting
Mount a Partition
sudo mount /dev/sdb1 /mnt/data
Mount with Specific Filesystem (-t)
Usually auto-detected, but can be forced.
sudo mount -t ext4 /dev/sdb1 /mnt/data
sudo mount -t vfat /dev/sdc1 /mnt/usb
sudo mount -t ntfs-3g /dev/sdd1 /mnt/windows
View All Mounts
mount
mount | column -t
findmnt.
Advanced Mounting
Bind Mount (--bind)
Remount part of the file hierarchy somewhere else. (e.g., Make /var/www appear in /home/user/www).
sudo mount --bind /var/www /home/user/www
Loop Mount (ISO Files)
Mount a disk image (.iso, .img) as if it were a physical drive.
sudo mount -o loop disk.iso /mnt/iso
Read-Only Mount (-r, -o ro)
sudo mount -o ro /dev/sdb1 /mnt/secure
Remount (rw/ro)
Change permissions without unmounting.
sudo mount -o remount,rw /mnt/secure
The /etc/fstab File
For persistent mounts (survive reboot), edit /etc/fstab.
Syntax:
<device> <dir> <type> <options> <dump> <fsck>
Example:
# Device MountPoint Type Options Dump Pass
UUID=123-abc /data ext4 defaults 0 2
/swapfile none swap sw 0 0
//192.168.1.5/ /mnt/net cifs username=guest 0 0
To test fstab without rebooting:
sudo mount -a
Unmounting (umount)
Note: The command is umount, not unmount.
sudo umount /mnt/data
sudo umount /dev/sdb1
"Target is busy"?
If umount fails because the device is busy:
1. Check who is using it: lsof /mnt/data
2. Lazy unmount (detach now, clean up when process finishes):
sudo umount -l /mnt/data
sudo umount -f /mnt/net
Notes
- Mount Points: The directory
/mnt/datamust exist before mounting. - UUID: Always prefer UUIDs (
blkid) over/dev/sdb1infstab, as device names can change.