Your Linux system’s storage needs often extend beyond the main hard drive. Knowing how to mount disk in linux is a fundamental skill for any user who wants to access external drives, network storage, or additional partitions.
Mounting a disk makes its files available in your system’s directory tree. Without mounting, the operating system cannot see or use the disk’s data. This guide walks you through the entire process step by step.
We’ll cover everything from identifying the disk to making mounts permanent. You’ll learn commands, best practices, and common troubleshooting tips.
Understanding Disk Mounting In Linux
In Linux, everything is a file. Even hardware devices are represented as files in the /dev directory. When you connect a disk, the kernel creates a device file for it.
Mounting attaches that device file to a specific directory called a mount point. Once mounted, you can access the disk’s contents through that directory.
The mount command is your primary tool. It tells the kernel to associate a filesystem with a location in the directory tree.
What Happens When You Mount A Disk
The kernel reads the filesystem structure from the disk. It then maps that structure to a directory you specify. After mounting, any read or write operation to that directory actually goes to the disk.
Unmounting detaches the disk. Always unmount before physically removing a drive to prevent data corruption.
Common Mount Points
/mnt– Traditionally used for temporary mounts/media– Often used by desktop environments for removable drives/run/media/username– Modern systems may use this for automatic mounting
How To Mount Disk In Linux: Step-By-Step Guide
Let’s get practical. Follow these steps to mount any disk on your Linux system.
Step 1: Identify The Disk
First, you need to know which device file represents your disk. Use the lsblk command to list block devices.
lsblk
This shows all disks, partitions, and their mount points. Look for your new disk. It might be /dev/sdb or /dev/sdc depending on your system.
You can also use fdisk -l for more detailed information. Run it with sudo for full access.
sudo fdisk -l
Identify the disk by its size or label. Note the partition name, like /dev/sdb1.
Step 2: Check The Filesystem Type
Knowing the filesystem helps you choose the right mount options. Use blkid to see filesystem types.
sudo blkid
Common filesystems include ext4, NTFS, FAT32, and XFS. Each may require specific drivers or options.
Step 3: Create A Mount Point
A mount point is just an empty directory. Create one where you want to access the disk.
sudo mkdir /mnt/mydisk
Choose a descriptive name. Avoid spaces in directory names for easier command usage.
Step 4: Mount The Disk
Now use the mount command. The basic syntax is:
sudo mount /dev/sdb1 /mnt/mydisk
Replace /dev/sdb1 with your partition and /mnt/mydisk with your mount point.
If the filesystem is not automatically detected, specify it with the -t option.
sudo mount -t ext4 /dev/sdb1 /mnt/mydisk
Step 5: Verify The Mount
Check that the disk is mounted correctly. Use lsblk or mount without arguments.
mount | grep /mnt/mydisk
You should see your device listed with the mount point. Also try listing the directory contents.
ls /mnt/mydisk
Step 6: Unmount When Done
Always unmount before disconnecting. Use the umount command (note the spelling: no ‘n’ after ‘u’).
sudo umount /mnt/mydisk
You can also specify the device instead of the mount point.
sudo umount /dev/sdb1
Making Mounts Permanent With /Etc/fstab
Temporary mounts disappear after reboot. To mount automatically at boot, edit the /etc/fstab file.
This file defines filesystem mount points and options. One mistake can prevent your system from booting, so be careful.
Finding Disk UUID
Using device names like /dev/sdb1 is unreliable because they can change. Use the UUID (Universally Unique Identifier) instead.
sudo blkid
Copy the UUID for your partition. It looks like UUID="abc123-...".
Editing /Etc/fstab
Open the file with a text editor as root.
sudo nano /etc/fstab
Add a line with this format:
UUID=your-uuid /mnt/mydisk ext4 defaults 0 2
Replace your-uuid, /mnt/mydisk, and ext4 with your values. The last two numbers are dump and pass options.
Save and exit. Test the entry with:
sudo mount -a
This mounts all filesystems in fstab. If there’s an error, fix it immediately.
Mounting Different Filesystem Types
Each filesystem has specific requirements. Here are common ones you’ll encounter.
Mounting NTFS Drives
Windows NTFS drives need the ntfs-3g driver. Install it first.
sudo apt install ntfs-3g # Debian/Ubuntu
sudo dnf install ntfs-3g # Fedora
Mount with:
sudo mount -t ntfs-3g /dev/sdb1 /mnt/windows
Mounting FAT32 Drives
FAT32 is common on USB drives. Mount it simply:
sudo mount /dev/sdb1 /mnt/usb
Add options for user permissions if needed.
sudo mount -o uid=1000,gid=1000 /dev/sdb1 /mnt/usb
Mounting ISO Files
You can mount disk images without burning them.
sudo mount -o loop /path/to/file.iso /mnt/iso
The -o loop option creates a loop device for the file.
Advanced Mount Options
Customize mounts with various options. They go after -o in the mount command.
Read-Only Mounts
Protect data by mounting as read-only.
sudo mount -o ro /dev/sdb1 /mnt/mydisk
Permissions And Ownership
Set file permissions with umask, uid, and gid options.
sudo mount -o umask=022,uid=1000,gid=1000 /dev/sdb1 /mnt/mydisk
Noexec Option
Prevent execution of binaries on the mounted filesystem.
sudo mount -o noexec /dev/sdb1 /mnt/mydisk
Troubleshooting Common Mount Issues
Even experienced users hit problems. Here are solutions to frequent errors.
Device Is Busy
If you get “device is busy,” a process is using the mount point. Find it with lsof.
sudo lsof /mnt/mydisk
Kill the process or close the file. Then unmount.
Wrong Filesystem Type
If mount fails with “wrong fs type,” install the required driver. For exFAT, install exfat-utils.
Permission Denied
Non-root users may lack permissions. Use sudo or add the user option in fstab.
UUID=your-uuid /mnt/mydisk ext4 defaults,user 0 2
Mount Point Not Empty
Mounting to a non-empty directory hides its contents. Use an empty directory or move files first.
Automounting With Systemd
Modern Linux systems use systemd for service management. You can create automount units.
Create a mount unit file in /etc/systemd/system. Name it after the mount point, replacing slashes with dashes.
For /mnt/mydisk, create mnt-mydisk.mount.
[Unit]
Description=My Disk Mount
[Mount]
What=/dev/disk/by-uuid/your-uuid
Where=/mnt/mydisk
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target
Enable and start it.
sudo systemctl enable mnt-mydisk.mount
sudo systemctl start mnt-mydisk.mount
Using Graphical Tools
Desktop environments offer GUI tools for mounting. GNOME Disks, KDE Partition Manager, and others simplify the process.
They handle identification, mounting, and fstab editing. But knowing the command line gives you more control.
Security Considerations
Mounting external disks can introduce risks. Malicious filesystems might exploit vulnerabilities.
Use read-only mounts for unknown drives. Scan with antivirus if needed. Avoid auto-mounting untrusted devices.
Frequently Asked Questions
What Is The Difference Between Mount And Mount Point?
The mount command attaches a filesystem. A mount point is the directory where it becomes accessible. You mount a device to a mount point.
Can I Mount Multiple Disks To The Same Directory?
No, only one filesystem can be mounted at a single mount point. Unmount the first before mounting another.
How Do I Mount A Disk Automatically At Boot?
Add an entry to /etc/fstab with the UUID, mount point, filesystem type, and options. Use sudo mount -a to test.
Why Does My Mount Command Fail With “Permission Denied”?
Only root can mount filesystems by default. Use sudo or add the user option in fstab to allow regular users.
What Is The Safest Way To Unmount A Disk?
Use sudo umount /mount/point. Ensure no processes are using the disk. For removable drives, sync first with sync.
Best Practices For Disk Mounting
Follow these tips to avoid problems and keep your system stable.
- Always use UUIDs in fstab instead of device names
- Test fstab entries with
mount -abefore rebooting - Unmount before physically removing drives
- Use descriptive mount point names
- Backup fstab before editing
- Check disk health with
smartctlregularly
Conclusion
Mounting disks in Linux is a core skill that gives you full control over storage. You’ve learned to identify disks, create mount points, mount and unmount filesystems, and make mounts permanent.
Practice with a spare USB drive. Experiment with different filesystems and options. The more you use these commands, the more natural they become.
Remember the key steps: identify, create mount point, mount, verify, and unmount. For permanent mounts, edit fstab carefully. With this knowledge, you can handle any storage task on Linux.