๐Ÿง How to Use the mount Command in Linux (Step-by-Step Guide)

๐Ÿง How to Use the mount Command in Linux (Step-by-Step Guide)
Operating System(s)

The mount command in Linux lets you attach storage devices or filesystems (USB drives, hard disks, ISO files) to your system so you can access their contents.

๐Ÿ”Ž What is mount?

In Linux, devices arenโ€™t accessed directlyโ€”theyโ€™re mounted to a directory (called a mount point).

๐Ÿ‘‰ Example: a USB drive might be mounted to /mnt/usb

โœ… Basic Syntax

mount [options] device mount_point

๐Ÿ“‚ Step 1: Identify the Device

List available drives:

lsblk

๐Ÿ‘‰ Look for something like /dev/sdb1

๐Ÿ“ Step 2: Create a Mount Point

sudo mkdir -p /mnt/usb

๐Ÿ”— Step 3: Mount the Device

sudo mount /dev/sdb1 /mnt/usb

๐Ÿ‘‰ You can now access files in /mnt/usb

๐Ÿ“ค Unmount the Device

Before removing a drive, unmount it:

sudo umount /mnt/usb

๐Ÿ‘‰ Always unmount to prevent data loss

๐Ÿง  Mount with Filesystem Type

sudo mount -t ext4 /dev/sdb1 /mnt/usb

Common types:

  • ext4 (Linux)
  • ntfs (Windows)
  • vfat (USB drives)

๐Ÿ’ฟ Mount an ISO File

 

sudo mount -o loop file.iso /mnt/iso

 

๐Ÿ‘‰ Lets you browse ISO contents without burning it

โš™๏ธ Useful Options

OptionDescription
-tSpecify filesystem type
-oMount options
-rRead-only mode
-wRead/write mode
-aMount all from /etc/fstab

๐Ÿ“Œ Auto-Mount with /etc/fstab

To mount automatically at boot:

/dev/sdb1  /mnt/usb  ext4  defaults  0  2

๐Ÿ‘‰ Add this line to /etc/fstab

๐Ÿš€ Real-World Examples

Mount USB drive

 

sudo mount /dev/sdb1 /mnt/usb

 

Mount read-only

 

sudo mount -o ro /dev/sdb1 /mnt/usb

 

Mount Windows partition

sudo mount -t ntfs /dev/sdb1 /mnt/windows

โš ๏ธ Common Mistakes

  • โŒ Forgetting sudo
  • โŒ Not creating mount point
  • โŒ Removing drive without unmounting
  • โŒ Wrong filesystem type

๐Ÿง  Pro Tips

  • Use lsblk or blkid to verify devices
  • Use /media or /mnt for mount points
  • Always unmount before unplugging drives
  • Check mounts with:

    mount | grep sdb1

๐Ÿ‘ Quick Summary

  • mount connects a device to a directory
  • Use umount to safely disconnect
  • Works with USB, disks, and ISO files
  • Configure /etc/fstab for auto-mount

๐ŸŽฏ Final Thoughts

The mount command is essential for managing storage in Linux. Once you understand mount points and device paths, you can easily work with any disk, USB drive, or ISO file like a pro.

Force Cache (Faster Mirror)

Linux Commands

Files

tar ยท pv ยท cat ยท tac ยท chmod ยท grep ยท  diff ยท sed ยท ar ยท man ยท pushd ยท popd ยท fsck ยท testdisk ยท seq ยท fd ยท pandoc ยท cd ยท $PATH ยท awk ยท join ยท jq ยท fold ยท uniq ยท journalctl ยท tail ยท stat ยท ls ยท fstab ยท echo ยท less ยท chgrp ยท chown ยท rev ยท look ยท strings ยท type ยท rename ยท zip ยท unzip ยท mount ยท umount ยท install ยท fdisk ยท mkfs ยท rm ยท rmdir ยท rsync ยท df ยท gpg ยท vi ยท nano ยท mkdir ยท du ยท ln ยท patch ยท convert ยท rclone ยท shred ยท srm ยท scp ยท gzip ยท chattr ยท cut ยท find ยท umask ยท wc ยท tr ยท hash  ยท compgen

Processes

alias ยท screen ยท top ยท nice ยท renice ยท progress ยท strace ยท systemd ยท tmux ยท chsh ยท history ยท at ยท batch ยท free ยท which ยท dmesg ยท chfn ยท usermod ยท ps ยท chroot ยท xargs ยท tty ยท pinky ยท lsof ยท vmstat ยท timeout ยท wall ยท yes ยท kill ยท sleep ยท sudo ยท su ยท time ยท groupadd ยท usermod ยท groups ยท lshw ยท shutdown ยท reboot ยท halt ยท poweroff ยท passwd ยท lscpu ยท crontab ยท date ยท bg ยท fg ยท pidof ยท nohup ยท pmap

Networking

netstat ยท ping ยท traceroute ยท ip ยท ss ยท whois ยท fail2ban ยท bmon ยท dig ยท finger ยท nmap ยท ftp ยท curl ยท wget ยท who ยท whoami ยทยท iptables ยท ssh-keygen ยท ufw ยท arping ยท firewalld