Mount a Disk in Linux (fstab)
This guide covers how to find a disk, format it, mount it manually, and make the mount permanent using /etc/fstab on Debian-based Linux systems (Ubuntu, Debian, Pop!_OS).
Step 1 – Find Your Disk
List all connected disks and partitions:
lsblkExample output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 500G 0 disk
└─sda1 8:1 0 500G 0 part /
sdb 8:16 0 2T 0 diskHere sdb is the new disk with no partitions yet.
Step 2 – Format the Disk
Create a new partition table and partition:
sudo fdisk /dev/sdbInside fdisk:
- Press
gto create a new GPT partition table - Press
nto create a new partition - Press Enter three times to accept defaults (uses full disk)
- Press
wto write and exit
Format the partition as ext4:
sudo mkfs.ext4 /dev/sdb1Step 3 – Create a Mount Point
Create the folder where the disk will be accessible:
sudo mkdir -p /mnt/storageStep 4 – Mount the Disk Manually
Test the mount before making it permanent:
sudo mount /dev/sdb1 /mnt/storageVerify it worked:
df -h | grep storageStep 5 – Make It Permanent with fstab
Find the disk’s UUID (never use /dev/sdb in fstab — device names can change after reboot):
sudo blkid /dev/sdb1Example output:
/dev/sdb1: UUID="a1b2c3d4-e5f6-7890-abcd-ef1234567890" TYPE="ext4"Copy the UUID, then open fstab:
sudo nano /etc/fstabAdd this line at the bottom (replace the UUID with yours):
UUID=a1b2c3d4-e5f6-7890-abcd-ef1234567890 /mnt/storage ext4 defaults 0 2What the fields mean:
UUID=...— the disk identifier/mnt/storage— where it mountsext4— filesystem typedefaults— standard mount options0— do not dump (backup)2— fsck order (2 = check after root disk)
Step 6 – Test the fstab Entry
Test without rebooting:
sudo mount -aIf no errors appear, the fstab entry is correct. The disk will now mount automatically on every boot.
Set Permissions (Optional)
If you want your regular user to write to the disk:
sudo chown -R $USER:$USER /mnt/storageQuick Reference
| Command | What it does |
|---|---|
lsblk |
List all disks and partitions |
sudo blkid /dev/sdb1 |
Show UUID of a partition |
sudo fdisk /dev/sdb |
Partition a disk |
sudo mkfs.ext4 /dev/sdb1 |
Format as ext4 |
sudo mount /dev/sdb1 /mnt/storage |
Mount manually |
sudo mount -a |
Mount all fstab entries |
df -h |
Show mounted disks and usage |
Related Links
- Mount a Network Share in Linux (fstab) — mount Samba and NFS shares
- Set Up Samba File Sharing on Linux — share folders to Windows and macOS
- Arch Wiki – fstab — detailed fstab documentation