|

Linux CLI 27 🐧 mount and umount commands

mount
mount -t ext4
mount -t btrfs
sudo fdisk -l

The mount command attaches a filesystem or device to a directory (the mount point) so its contents become accessible. The umount command detaches it.

Key point: A device must be mounted before you can read or write to its files. Linux treats everything as a file — including devices and filesystems.


a – mount options

mount allows you to control how filesystems are mounted/remounted on the system.

CommandDescription
mountLists the file systems
mount -t ext4Lists the ext4 file systems
mount -t btrfsLists the btrfs file systems
mount -aMounts all currently configured file systems (/etc/fstab)
mount -hShows the help
mount -lLists all the mounted file systems with detailed information
sudo mount -lLists all the mounted file systems with detailed information
sudo fdisk -lBetter way to see the devices

Examples:

# List all mounted filesystems
$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8123456k,nr_inodes=2030614,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1629216k,mode=755)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /home type ext4 (rw,relatime)
/dev/sdc1 on /media/usbA type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437)

# List only ext4 filesystems
$ mount -t ext4
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /home type ext4 (rw,relatime)

# List only btrfs filesystems
$ mount -t btrfs
/dev/sdd1 on /mnt/data type btrfs (rw,relatime,space_cache,subvolid=5,subvol=/)

# Mount all filesystems in /etc/fstab
$ sudo mount -a

# Show help
$ mount -h

# List with detailed info
$ sudo mount -l
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro) [root]
/dev/sdb1 on /home type ext4 (rw,relatime) [home]
/dev/sdc1 on /media/usbA type vfat (rw,nosuid,nodev,relatime) [USB-A]

# Better way to see the devices
$ sudo fdisk -l
Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Samsung SSD 860
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 12345678-ABCD-EF00-1234-56789ABCDEF0

Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M EFI System
/dev/sda2  1050624 500118158 499067535 237.9G Linux filesystem

Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX
...
Device     Boot Start        End    Sectors   Size Id Type
/dev/sdb1        2048 1953521663 1953519616 931.5G 83 Linux

Disk /dev/sdc: 14.9 GiB, 16008609792 bytes, 31266816 sectors
Disk model: USB Flash Drive
...
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1        2048 31266815 31264768 14.9G  c W95 FAT32 (LBA)

b – mount a device

To mount a device/drive:

  1. Create a mount point — where you want it to be mounted
  2. Find the device with fdisk -l
  3. Mount the device to the mount point
CommandDescription
mkdir /media/usbACreates a mount point
sudo fdisk -lFinds the device
sudo mount /dev/sdc1 /media/usbAMounts the sdc1 device to the mount point /media/usbA

Examples:

# Step 1: Create a mount point
$ sudo mkdir /media/usbA

# Step 2: Find the device
$ sudo fdisk -l
...
Disk /dev/sdc: 14.9 GiB, 16008609792 bytes, 31266816 sectors
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1        2048 31266815 31264768 14.9G  c W95 FAT32 (LBA)

# Step 3: Mount the device
$ sudo mount /dev/sdc1 /media/usbA

# Verify
$ mount | grep usbA
/dev/sdc1 on /media/usbA type vfat (rw,nosuid,nodev,relatime,...)

$ ls /media/usbA
file1.txt  file2.txt  photos/

Mount an ISO file:

# Create a mount point
$ sudo mkdir /media/testISO

# Mount the ISO using a loop device
$ sudo mount /testFile.iso /media/testISO -o loop

# Verify
$ mount | grep testISO
/testFile.iso on /media/testISO type iso9660 (ro,relatime)

$ ls /media/testISO
autorun.inf  setup.exe  ...

-o loop mounts the ISO’s data into a loop device — a pseudo-device that makes a file look like a block device.

Common mount options (-o):

OptionDescription
loopMount a file as a block device (ISO)
roMount read-only
rwMount read-write
noexecPrevent execution of binaries
nosuidIgnore SUID/SGID bits
uid=1000Set owner of files
gid=1000Set group of files
remountRemount with new options

c – move a mount and unmount

Move a mount point:

# Move /media/usbA to /media/usbB
$ sudo mount --move /media/usbA /media/usbB

# Verify
$ mount | grep usbB
/dev/sdc1 on /media/usbB type vfat (rw,...)

Unmount a device:

umount is used to unmount a previously mounted file system/device.

CommandDescription
umount -aUnmounts all filesystems/devices
umount -fForces the unmount
sudo umount /media/usbAUnmounts what is mounted at /media/usbA

Examples:

# Unmount a device by mount point
$ sudo umount /media/usbA

# Unmount by device
$ sudo umount /dev/sdc1

# Force unmount (busy device)
$ sudo umount -f /media/usbA

# Unmount all
$ sudo umount -a

# Verify it's gone
$ mount | grep usbA
# (no output — unmounted)

Note: umount (not unmount) is the actual command name. It’s easy to mistype.


Complete Example Session

# ============================================
# PART 1: LIST MOUNTED FILESYSTEMS
# ============================================

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /home type ext4 (rw,relatime)
...

# Only ext4
$ mount -t ext4
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /home type ext4 (rw,relatime)

# Only btrfs
$ mount -t btrfs
/dev/sdd1 on /mnt/data type btrfs (rw,relatime,...)

# With labels
$ sudo mount -l
/dev/sda2 on / type ext4 (rw,relatime) [root]
/dev/sdb1 on /home type ext4 (rw,relatime) [home]

# ============================================
# PART 2: FIND DEVICES
# ============================================

$ sudo fdisk -l
Disk /dev/sda: 238.47 GiB ...
Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M EFI System
/dev/sda2  1050624 500118158 499067535 237.9G Linux filesystem

Disk /dev/sdc: 14.9 GiB ...
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1        2048 31266815 31264768 14.9G  c W95 FAT32 (LBA)

# ============================================
# PART 3: MOUNT A USB DRIVE
# ============================================

$ sudo mkdir /media/usbA
$ sudo mount /dev/sdc1 /media/usbA

$ mount | grep usbA
/dev/sdc1 on /media/usbA type vfat (rw,nosuid,nodev,relatime,...)

$ ls /media/usbA
file1.txt  file2.txt  photos/

# ============================================
# PART 4: MOUNT AN ISO
# ============================================

$ sudo mkdir /media/testISO
$ sudo mount /testFile.iso /media/testISO -o loop

$ mount | grep testISO
/testFile.iso on /media/testISO type iso9660 (ro,relatime)

$ ls /media/testISO
autorun.inf  setup.exe  ...

# ============================================
# PART 5: MOVE A MOUNT POINT
# ============================================

$ sudo mount --move /media/usbA /media/usbB

$ mount | grep usbB
/dev/sdc1 on /media/usbB type vfat (rw,...)

# ============================================
# PART 6: UNMOUNT
# ============================================

$ sudo umount /media/usbB
$ mount | grep usbB
# (no output)

# Force unmount if busy
$ sudo umount -f /media/usbA

# Unmount all
$ sudo umount -a

# ============================================
# PART 7: REMOUNT WITH NEW OPTIONS
# ============================================

# Remount read-only
$ sudo mount -o remount,ro /media/usbA

# Verify
$ mount | grep usbA
/dev/sdc1 on /media/usbA type vfat (ro,...)

# Remount read-write
$ sudo mount -o remount,rw /media/usbA

Quick Reference

Listing

CommandPurpose
mountList all mounted filesystems
mount -t TYPEList filesystems of a type
mount -lList with labels
sudo fdisk -lList all disks and partitions

Mounting

CommandPurpose
mkdir /mnt/pointCreate a mount point
sudo mount /dev/sdX /mnt/pointMount a device
sudo mount /path/file.iso /mnt/point -o loopMount an ISO
sudo mount -aMount all from /etc/fstab
sudo mount -o remount,rw /mnt/pointRemount with new options
sudo mount --move /old /newMove a mount point

Unmounting

CommandPurpose
sudo umount /mnt/pointUnmount by mount point
sudo umount /dev/sdXUnmount by device
sudo umount -f /mnt/pointForce unmount
sudo umount -aUnmount all

Common -o Options

OptionMeaning
loopMount a file as a block device
roRead-only
rwRead-write
noexecNo execution
nosuidIgnore SUID/SGID
uid=1000Set owner
gid=1000Set group
remountRemount with new options

Best Practices

Do This:

# Always create the mount point first
sudo mkdir -p /media/usbA            # ✅
sudo mount /dev/sdc1 /media/usbA

# Use fdisk -l to find the right device
sudo fdisk -l                        # ✅

# Unmount before removing a USB drive
sudo umount /media/usbA              # ✅

# Use -o loop for ISO files
sudo mount file.iso /mnt -o loop     # ✅

# Verify after mounting
mount | grep usbA                    # ✅

# Use -f only when necessary
sudo umount -f /media/usbA           # ✅ (busy device)

Don’t Do This:

# Don't mount without a mount point
sudo mount /dev/sdc1                 # ❌ no target

# Don't pull a USB without unmounting
# (can cause data loss)              # ❌

# Don't mistype the command name
sudo unmount /media/usbA             # ❌ it's umount!

# Don't mount over a non-empty directory
sudo mount /dev/sdc1 /home           # ❌ hides your files

# Don't forget sudo
mount /dev/sdc1 /media/usbA          # ❌ permission denied

Common Pitfalls

PitfallProblemSolution
unmount typoCommand not foundUse umount
Mount point missingMount failsmkdir first
Device busyCannot unmountumount -f or close files
Wrong deviceData loss riskVerify with fdisk -l
No sudoPermission deniedPrefix with sudo
ISO not mountingMissing -o loopAdd -o loop
Mount over non-empty dirHidden filesMount to empty dir
Forgot to unmount USBData corruptionAlways umount first

Real-World Examples

1. Mount a USB Drive

$ sudo fdisk -l
...
Disk /dev/sdc: 14.9 GiB ...
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1        2048 31266815 31264768 14.9G  c W95 FAT32 (LBA)

$ sudo mkdir /media/usbA
$ sudo mount /dev/sdc1 /media/usbA
$ ls /media/usbA
$ sudo umount /media/usbA

2. Mount an ISO File

$ sudo mkdir /media/testISO
$ sudo mount /home/kronos/ubuntu.iso /media/testISO -o loop
$ ls /media/testISO
$ sudo umount /media/testISO

3. Mount a Second Hard Drive

$ sudo mkdir /mnt/data
$ sudo mount /dev/sdb1 /mnt/data
$ df -h /mnt/data
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       916G  120G  750G  14% /mnt/data
$ sudo umount /mnt/data

4. Remount Root Read-Only (Recovery)

$ sudo mount -o remount,ro /
$ mount | grep ' / '
/dev/sda2 on / type ext4 (ro,relatime)

5. Mount All from /etc/fstab

$ sudo mount -a
# Mounts everything listed in /etc/fstab that isn't already mounted

6. Move a Mount Point

$ sudo mount --move /media/usbA /media/usbB
$ mount | grep usbB
/dev/sdc1 on /media/usbB type vfat (rw,...)

7. Force Unmount a Busy Device

$ sudo umount /media/usbA
umount: /media/usbA: target is busy.

$ sudo umount -f /media/usbA
# Forced unmount

8. Check Filesystem Type Before Mounting

$ lsblk -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
sda
├─sda1 vfat         1234-ABCD                            /boot/efi
└─sda2 ext4         5678-EFGH                            /
sdb
└─sdb1 ext4         90AB-CDEF                            /home
sdc
└─sdc1 vfat   USB-A 3456-GHIJ

Visual: Mounting a Device

┌──────────────────────────────────────────────┐
│           Before Mount                       │
│                                              │
│  /dev/sdc1  ← device (not accessible)        │
│  /media/usbA  ← empty directory              │
│                                              │
└─────────────────┬────────────────────────────┘
                  │
                  │  sudo mount /dev/sdc1 /media/usbA
                  ▼
┌──────────────────────────────────────────────┐
│           After Mount                        │
│                                              │
│  /dev/sdc1  ←──────┐                         │
│                    │                         │
│  /media/usbA  ←────┘  (contents accessible)  │
│                                              │
│  $ ls /media/usbA → file1.txt file2.txt      │
│                                              │
└─────────────────┬────────────────────────────┘
                  │
                  │  sudo umount /media/usbA
                  ▼
┌──────────────────────────────────────────────┐
│           After Unmount                      │
│                                              │
│  /dev/sdc1  ← detached                       │
│  /media/usbA  ← empty again                  │
│                                              │
└──────────────────────────────────────────────┘

Summary

CommandPurposeExample
mountList mounted filesystemsmount
mount -t ext4List ext4 filesystemsmount -t ext4
mount -t btrfsList btrfs filesystemsmount -t btrfs
mount -aMount all from /etc/fstabsudo mount -a
mount -lList with labelssudo mount -l
fdisk -lList devicessudo fdisk -l
mount /dev/sdX /mntMount a devicesudo mount /dev/sdc1 /media/usbA
mount file.iso /mnt -o loopMount an ISOsudo mount /x.iso /mnt -o loop
mount --move /old /newMove mount pointsudo mount --move /a /b
umount /mntUnmountsudo umount /media/usbA
umount -fForce unmountsudo umount -f /media/usbA
umount -aUnmount allsudo umount -a

Key takeaways:

  • mount attaches a filesystem/device to a directory (the mount point)
  • umount (not unmount!) detaches it
  • Use sudo fdisk -l to find devices — better than mount for this
  • Always create the mount point with mkdir before mounting
  • Use -o loop to mount ISO files
  • Use mount --move to relocate a mount point
  • Use umount -f to force unmount a busy device
  • Always unmount before removing a USB drive to avoid data loss
  • Use mount -o remount,rw to change options on a mounted filesystem

Remember: mount makes a device’s contents available at a directory. umount detaches it. Use fdisk -l to find devices, mkdir to create mount points, and -o loop for ISOs. The most common mistake is typing unmount instead of umount. Always unmount USB drives before pulling them out. Verify with mount | grep after mounting. Master mount and umount, and you control how storage appears on your system.


Stop using slow, ad-bloated tool sites! 🤮

🔎 Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
✅ Finance (Mortgage, Interest, Inflation)
✅ Tech (Base64, JSON, Dev Suite, IP)
✅ Health (BMI, BMR, TDEE)
✅ Productivity (Timer, Workspace, QR)

⚡️ Fast & Private
🔒 No data leaves your device
💎 100% Free

🔗 Use it now: https://tools.kandz.me
🔖 Bookmark it—you’ll need it later!