Mount a drive permanently with fstab in Linux Rumi, April 16, 2025 Step 1: Find the UUID of the drive First, you need to find the UUID of the drive you want to mount. You can do this by running the following command: sudo blkid This will list all the drives connected to your system along with their UUIDs. For example, the output might look like this: /dev/sda1: UUID="b8e4a1f6-6e8f-4f6e-8b6e-6e8f4f6e8b6e" BLOCK_SIZE="4096" TYPE="ext4" /dev/sdb1: UUID="c8e4a1f6-6e8f-4f6e-8b6e-6e8f4f6e8b6e" BLOCK_SIZE="4096" TYPE="ext4" In this example, /dev/sda1 is the drive we want to mount, and its UUID is b8e4a1f6-6e8f-4f6e-8b6e-6e8f4f6e8b6e. How to check what’s the device name of the drive you want to mount? You can use the lsblk command to list all the drives connected to your system along with their device names. For example: lsblk This will show you a tree-like view of all the drives connected to your system. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 94.5M 1 loop /snap/lxd/30135 loop1 7:1 0 69.2M 1 loop /snap/core22/1590 loop2 7:2 0 69.2M 1 loop /snap/core22/1614 loop3 7:3 0 94.5M 1 loop /snap/lxd/29946 loop4 7:4 0 33.7M 1 loop /snap/snapd/21761 sda 8:0 0 931.5G 0 disk └─sda1 8:1 0 931.5G 0 part mtdblock0 31:0 0 16M 0 disk nvme0n1 259:0 0 931.5G 0 disk ├─nvme0n1p1 259:1 0 4M 0 part └─nvme0n1p2 259:2 0 931.5G 0 part / In this example, /dev/sda and /dev/nvme0n1 are the drives connected to the system, and from our example we want to mount /dev/sda1. Step 2: Create a mount point Next, you need to create a directory where you want to mount the drive. You can create a new directory using the mkdir command. Usually people mount drives under /mnt or /media directories. You can choose any directory you like. I’ll go ahead with the /mnt directory. sudo mkdir /mnt/mydrive Step 3: Edit the fstab file Now, you need to edit the fstab file to add an entry for the drive you want to mount. You can do this by running the following command: sudo vi /etc/fstab I am choosing vi as the text editor here. You can choose any text editor you like. The fstab file contains information about all the drives that are mounted automatically on boot. You need to add an entry for the drive you want to mount. The entry should look like this: UUID=b8e4a1f6-6e8f-4f6e-8b6e-6e8f4f6e8b6e /mnt/mydrive ext4 defaults 0 0 Now you can save the file and exit the text editor. Step 4: Mount the drive Finally, you can mount the drive by running the following command: sudo mount -a If you do not see any errors, then the drive has been mounted successfully. You can verify this by running the df command which will show you all the drives mounted on your system. df -h This will show you a list of all the drives mounted on your system along with their mount points. Filesystem Size Used Avail Use% Mounted on tmpfs 1.6G 4.4M 1.6G 1% /run /dev/nvme0n1p2 917G 154G 726G 18% / tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sda1 916G 274G 597G 32% /mnt/mydrive tmpfs 1.6G 12K 1.6G 1% /run/user/1000 In this example, you can see that /dev/sda1 is mounted on /mnt/mydrive. Ref: Mount a drive permanently with fstab in Linux | Akash Rajpurohit Administrations Collected Articles Configurations (Linux) FstabLinux Mount