Accessing a specific partition in Linux requires identifying its device name and choosing a mount location. If you are new to Linux, learning how to mount a partition in linux is one of the first skills you need to manage storage. This guide walks you through every step, from finding the partition to making mounts permanent.
Mounting means attaching a partition to a directory so you can read and write files. Without mounting, the partition is just raw data. Let’s start with the basics and build up to advanced techniques.
Understanding Partitions And Mount Points
A partition is a section of a hard drive or SSD. Linux sees partitions as device files like /dev/sda1 or /dev/nvme0n1p2. A mount point is a directory where you access the partition’s content. Common mount points are /mnt or /media.
You can mount any partition to any empty directory. The directory must exist before you mount. If the directory has files, they become hidden until you unmount.
Identifying Your Partitions
First, list all block devices. Use lsblk in the terminal. This shows partitions, sizes, and mount points.
lsblk– simple tree viewlsblk -f– shows filesystem types and UUIDsfdisk -l– detailed partition table (needs root)
Look for partitions without a mount point. For example, /dev/sdb1 might be unmonted. Note the device name and filesystem type like ext4 or NTFS.
Creating A Mount Point
Decide where to mount. Use /mnt for temporary mounts or /media for removable drives. Create a directory:
sudo mkdir /mnt/mydata
Choose a descriptive name. Avoid spaces or special characters. The directory must be empty.
How To Mount A Partition In Linux
Now you mount the partition. The basic command is mount. You need root privileges, so use sudo.
sudo mount /dev/sdb1 /mnt/mydata
Replace /dev/sdb1 with your partition and /mnt/mydata with your mount point. If the filesystem is not detected automatically, specify it with -t:
sudo mount -t ext4 /dev/sdb1 /mnt/mydata
For NTFS partitions (Windows), use ntfs-3g:
sudo mount -t ntfs-3g /dev/sdb1 /mnt/mydata
Check success with lsblk or df -h. The partition should now appear under the mount point.
Mounting With UUID Instead Of Device Name
Device names like /dev/sdb1 can change after reboot. UUIDs are unique and stable. Find the UUID with lsblk -f. Then mount:
sudo mount UUID="your-uuid-here" /mnt/mydata
This is more reliable for scripts and permanent mounts.
Mounting With Options
You can add options like read-only or noexec. Use the -o flag:
sudo mount -o ro /dev/sdb1 /mnt/mydata
Common options:
ro– read-onlyrw– read-write (default)noexec– prevent execution of binariesuid=1000– set owner user ID
Unmounting A Partition
To detach a partition, use umount (note: no ‘n’ after ‘u’):
sudo umount /mnt/mydata
Or specify the device:
sudo umount /dev/sdb1
Always unmount before removing a drive. If you get “target is busy”, close any open files or terminals in that directory. Use lsof /mnt/mydata to see what’s using it.
Making Mounts Permanent With Fstab
To mount automatically at boot, edit /etc/fstab. This file defines filesystem mount points. Backup first:
sudo cp /etc/fstab /etc/fstab.backup
Then edit with a text editor:
sudo nano /etc/fstab
Add a line like this:
UUID=your-uuid /mnt/mydata ext4 defaults 0 2
Fields: device, mount point, filesystem type, options, dump (0), pass (2 for non-root). For NTFS:
UUID=your-uuid /mnt/mydata ntfs-3g defaults 0 0
Test the entry with:
sudo mount -a
If no errors, the mount works. Reboot to confirm.
Common Fstab Options
defaults– rw, suid, dev, exec, auto, nouser, asyncnoauto– do not mount at bootuser– allow any user to mountnofail– ignore errors if device missing
Mounting Different Filesystem Types
Linux supports many filesystems. Here are common ones and their mount commands.
Ext4 (Linux Native)
Most common for Linux. Mount with:
sudo mount /dev/sda1 /mnt/linux
NTFS (Windows)
Need ntfs-3g installed. On Ubuntu/Debian:
sudo apt install ntfs-3g
Then mount:
sudo mount -t ntfs-3g /dev/sdb1 /mnt/windows
FAT32 / ExFAT
Common for USB drives. Use:
sudo mount /dev/sdc1 /mnt/usb
For exFAT, install exfat-utils or exfat-fuse.
Btrfs
Modern Linux filesystem. Mount like ext4:
sudo mount /dev/sda2 /mnt/btrfs
Troubleshooting Common Mount Issues
Sometimes mounting fails. Here are fixes for common errors.
Filesystem Not Recognized
Error: “wrong fs type”. Install the proper driver. For NTFS, install ntfs-3g. For exFAT, install exfat-fuse.
Device Busy
Error: “target is busy”. Close all processes using the mount point. Use lsof or fuser:
sudo fuser -km /mnt/mydata
This kills processes. Be careful.
Permission Denied
You might not have write access. Check ownership with ls -ld /mnt/mydata. Change owner:
sudo chown $USER:$USER /mnt/mydata
Or mount with uid option:
sudo mount -o uid=1000 /dev/sdb1 /mnt/mydata
Corrupted Filesystem
If the partition has errors, repair it first. For ext4:
sudo fsck /dev/sdb1
Do not run on a mounted partition. Unmount first.
Mounting Partitions Automatically With Systemd
Modern Linux uses systemd. You can create a mount unit file instead of fstab. This is optional but useful for complex setups.
Create a file like /etc/systemd/system/mnt-mydata.mount:
[Unit]
Description=Mount mydata
[Mount]
What=/dev/sdb1
Where=/mnt/mydata
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target
Enable with:
sudo systemctl enable mnt-mydata.mount
sudo systemctl start mnt-mydata.mount
This method is cleaner for some admins.
Mounting With Labels
Partitions can have labels. Find labels with lsblk -f or blkid. Mount by label:
sudo mount LABEL="MyData" /mnt/mydata
Labels are easier to remember than UUIDs. Set a label with e2label for ext4:
sudo e2label /dev/sdb1 MyData
Mounting Network Drives
You can mount NFS or Samba shares. For NFS:
sudo mount -t nfs 192.168.1.100:/shared /mnt/nfs
For Samba (CIFS):
sudo mount -t cifs //192.168.1.100/share /mnt/smb -o username=user,password=pass
Add to fstab for permanent mounts. Use credentials file for security.
Mounting ISO Files
You can mount disk images as loop devices:
sudo mount -o loop /path/to/image.iso /mnt/iso
This works for ISO files. Unmount with umount.
Securing Mounted Partitions
For sensitive data, use encryption. LUKS is common. First, format the partition:
sudo cryptsetup luksFormat /dev/sdb1
Open it:
sudo cryptsetup open /dev/sdb1 myencrypted
Then mount the mapped device:
sudo mount /dev/mapper/myencrypted /mnt/secure
Unmount and close:
sudo umount /mnt/secure
sudo cryptsetup close myencrypted
Monitoring Mounted Partitions
Use df -h to see disk usage. mount alone lists all mounted filesystems. findmnt shows a tree view. These help you verify mounts.
Best Practices For Mounting
- Always use UUIDs in fstab for stability.
- Unmount before removing drives.
- Test fstab entries with
mount -abefore reboot. - Keep mount points organized under
/mntor/media. - Document your mounts for future reference.
Common Mistakes To Avoid
Do not mount to a non-empty directory. Files become hidden. Do not edit fstab without a backup. A wrong entry can prevent boot. Use recovery mode to fix.
Avoid mounting with defaults for NTFS without uid option. Permissions may be wrong. Test with a small file first.
FAQ
How Do I Mount A Partition In Linux Automatically?
Edit /etc/fstab with the partition’s UUID, mount point, and filesystem type. Then run sudo mount -a to test. It will mount at boot.
What Is The Difference Between Mount And Fstab?
mount is a command for temporary mounts. fstab is a configuration file for permanent mounts at boot. Both use similar syntax.
Can I Mount A Windows Partition In Linux?
Yes, use mount -t ntfs-3g. Install ntfs-3g if needed. You can also mount FAT32 and exFAT partitions.
Why Is My Partition Not Mounting At Boot?
Check fstab for typos. Use blkid to verify UUID. Ensure the mount point directory exists. Run sudo mount -a to see errors.
How Do I Mount A Partition With Read And Write Permissions?
Use defaults or rw option. For NTFS, add uid=1000,gid=1000 to set ownership. Check with mount | grep partition.
Now you have a complete guide on how to mount a partition in linux. Practice with a spare drive or USB stick. Once you master mounting, you can manage any storage device with confidence. Remember to always unmount safely and test fstab changes before rebooting.