← Back to list

How to automount partitions and removable devices on Linux

How many times you have to mount your secondary partitions? After each start at least, but sometimes your system auto-ejects devices if…

Francesco Pastore · 2020-12-20 09:38 · 0 claps · 1.7 min read
#linux #autofs #auto-mount #computer-memories #devices
Open on Medium ↗
Wiki topics: 🔓 · Open Source

How to automount partitions and removable devices on Linux

How many times do you have to mount your secondary partitions? After each start at least, but sometimes your system auto-ejects devices if not used. This could be very annoying, especially for your symlinks that will stop working.

On Linux it is easy to automount partitions with fstab. In this article, we will look at how to configure it to mount partitions on boot.

Find details about the device

To configure fstab, we need the UUID and the mount point of the device that we want to mount.

For example, I want to automount /dev/sda1 device with the label “Data”

For example, I want to automount /dev/sda1 device with the label “Data”

First we need to find the device name, try to search for it in the list of all available devices.

lsblk

Once you have found the device name (first column), get some details about it with this command.:

mount | grep <device>

The first entry is the device file path, while the second is the mount point.

Now we have to find the device UUID:

lsblk -no UUID <device-file-path>

In my case, I want to mount the sda1 partition

In my case, I want to mount the sda1 partition

Add a new entry to fstab

Open fstab with admin permission.

sudo vi /etc/fstab

Now add a new line, with vi editor go to the last line and then press o.

The new line should follow this format:

UUID=<device-uuid>   <mount-point>    auto    rw,user,auto 0 0

Where device-uuid is the uuid we found before with lsblk command, while mount point is the second entry of mount device details.

Look to the last line, it contains the sda1 partition data

Look to the last line, it contains the sda1 partition data

Restart and verify the configuration

Now, if everything works fine, your system should automatically mount the device on boot.


메타데이터
post_id
d1b6ded60ba4
slug
how-to-automount-partitions-and-removable-devices-on-linux-d1b6ded60ba4
url
https://medium.com/@2h3ph3rd/how-to-automount-partitions-and-removable-devices-on-linux-d1b6ded60ba4
canonical_url
https://medium.com/@2h3ph3rd/how-to-automount-partitions-and-removable-devices-on-linux-d1b6ded60ba4
author_url
https://medium.com/@2h3ph3rd
status
ok
fetched_at
2026-07-28 16:04:05