The mount
command in Linux is used to attach file systems, storage devices, and partitions to the system’s directory tree. It allows users to access external storage like USB drives, hard disks, ISO images, and network shares.
Summary of mount
Commands
Command | Description |
---|---|
mount |
List mounted file systems |
sudo mount /dev/sdb1 /mnt |
Mount partition |
sudo umount /mnt |
Unmount partition |
sudo mount -o loop file.iso /mnt |
Mount an ISO file |
sudo mount -t nfs server:/path /mnt |
Mount NFS share |
sudo mount -t ntfs-3g /dev/sdb1 /mnt |
Mount NTFS partition |
sudo mount -a |
Apply /etc/fstab changes |
1. View Mounted File Systems
To list currently mounted file systems:
or
๐น Displays a well-formatted list of mounted file systems.
To check only a specific device:
2. Mount a Disk Partition
To manually mount a partition (e.g., /dev/sdb1
to /mnt
):
๐น Now, /dev/sdb1
can be accessed under /mnt
.
Check the mount:
To specify the file system type (e.g., ext4
):
3. Unmount a File System
To unmount a partition:
or
๐น If it’s busy, use:
or
4. Mount an ISO File
To mount an ISO image:
๐น Now, the ISO contents can be accessed in /mnt
.
Unmount when done:
5. Mount a USB Drive
List USB devices:
If the USB is /dev/sdc1
, mount it:
6. Mount a Network Share (NFS)
Mount an NFS share from a remote server:
Unmount:
7. Mount a Windows (NTFS) Partition
To mount an NTFS partition:
8. Automatically Mount on Boot (Persistent Mount)
Find the UUID of the partition:
Edit /etc/fstab
:
Add:
Save and apply: