# \[Tutorial\] How to Permanently Mount External/Internal Drives in Linux

**URL:** <https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688>\
**Category:** Kernel, boot, graphics & hardware\
**Created:** [October 14, 2021, 6:15pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688 "2021-10-14T18:15:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![s4ndm4n](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/s4ndm4n/32/70472_2.png) [@s4ndm4n](https://forum.endeavouros.com/u/s4ndm4n)\
**Post date:** [October 14, 2021, 6:15pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/1 "2021-10-14T18:15:26Z")

</div>

When using external drives we have to manually mount them every time we log in to our Linux distribution or every time we want to use them. If you don’t remove them and use the drives as permanently connected external storage devices it would be great if we could automount them every time we log in to the system.

In this article, we will be looking at how to configure these external drives as automounted permanent storage devices. Using this method you can mount almost all external drives (Externalahrd drives, USB Sticks … etc.) or your internal drives.

> **NOTE1:** Please replace all the values within `< >` with your own values.

> **NOTE2:** All commands should be used in the terminal.

1. Identifying the drive and its device label. To achieve this you can use the command `lsblk` in your terminal.  

2. After identifying the drive label make note of it or remember the correct label. Now we have to make a new folder as the mount point for our external drive. You can use `/mnt` or `/run/media` (Becarfule using this because It is usually a temporary file system not intended to hold persistent data) or any other location but I’m going to use `/mnt` for this tutorial. To make the new folder we can use the `mkdir` command.

3. We still can’t use the new folder we created in the above step. Due to using `sudo` the new folder belongs to `root` not to your user. So we have to get ownership of the folder before continuing to other steps. To do this we use the `chown` command.

> NOTE: You can use `$USER` instead of your actual user name and user group.

- User group is similar to your user name. Ex: if your user name is `ben` then your user group will be `ben`. Unless you changed the user group.
  - `-R` switch makes the command operate on a file or a directory recursively.

1. After owning the folder we still can’t write to the folder so we need to give the folder read and write permissions. To do that, we can use the `chmod` command.

2. There are many ways we can use to mount drives using `fstab` but the best way is to use `UUID` to map the drives. So before we continue to the next step we need to find the `UUID` s of the drive/s that you’re mounting. To find the IDs, we can use `ls` or `blkid`. I personally prefer `blkid`.

3. After finding the `UUID` of your drive it is time to move on to editing the `fstab` file. Before starting the edit it’s always good to make a backup of the file. We can use the `cp` command to make back up.

4. Open the `fstab` file in your favorite text editor.

5. Add the below code to the end of the `fstab` file.

```auto
   UUID=<UUID of your external device> /mnt/<your mount point> <file system Ex: ext4> noatime,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=1min 0 2

```

- I’m using `systemd.automount` and `systemd.device-timeout`.

- `system.automount`: Automount units may be used to implement on-demand mounting as well as parallelized mounting of file systems. You can find more information [here](https://www.freedesktop.org/software/systemd/man/systemd.automount.html).

- `systemd.device-timeout`: Configures an idle timeout. Once the mount has been idle for the specified time, systemd will attempt to unmount. For more detail go [here](https://www.freedesktop.org/software/systemd/man/systemd.automount.html).

- Using `systemd` is much better because using other methods sometimes boot get stuck if the external device fails to mount. But using this method boot continues after the time mount times out.

1. Once making sure everything in the `fstab` is correct save and exit the editor. To make sure there are no errors mount the drives using the below command.

2. If there are no errors then it’s all good. You can test your new mounted drive now. Afterward, you can do a system reboot and verify that the automount is working. The newly mounted drives should show up in your file manager.

## Conclution

This brings us to the conclusion of this tutorial. I hope this tutorial is simple enough so anyone can understand and follow it without any issue. Using `UUID` and `systemd` is the best way I found to mount drives.

---

<div class="post-metadata">

**Author:** ![dalto](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/dalto/32/5577_2.png) [@dalto](https://forum.endeavouros.com/u/dalto)\
**Post date:** [October 14, 2021, 6:22pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/2 "2021-10-14T18:22:10Z")

</div>

Be careful creating permanent mounts in `/run/media`. It is usually a tmpfs not intended to hold persistent data.

---

<div class="post-metadata">

**Author:** ![Kresimir](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/kresimir/32/73739_2.png) [@Kresimir](https://forum.endeavouros.com/u/Kresimir)\
**Post date:** [October 14, 2021, 6:29pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/3 "2021-10-14T18:29:27Z")

</div>

I prefer that the mountpoint be owned by the root. Individual directories on the mounted drive can then be owned by whatever user needs them.

If my user needs to own the entire mountpoint, then I make it in my user’s home directory.

---

<div class="post-metadata">

**Author:** ![s4ndm4n](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/s4ndm4n/32/70472_2.png) [@s4ndm4n](https://forum.endeavouros.com/u/s4ndm4n)\
**Post date:** [October 14, 2021, 6:29pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/4 "2021-10-14T18:29:58Z")

</div>

Edit: Added @dalto 's warning to the article.

---

<div class="post-metadata">

**Author:** ![keybreak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/keybreak/32/9257_2.png) [@keybreak](https://forum.endeavouros.com/u/keybreak)\
**Post date:** [October 14, 2021, 6:36pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/5 "2021-10-14T18:36:20Z")

</div>

Huh…wait but why then auto-mounts like KDE creates as

```auto
/run/media/${USER}

```

? 🤔

---

<div class="post-metadata">

**Author:** ![pebcak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/pebcak/32/100472_2.png) [@pebcak](https://forum.endeavouros.com/u/pebcak)\
**Post date:** [October 14, 2021, 6:41pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/6 "2021-10-14T18:41:26Z")

</div>

Using systemd.mount, isn’t there any need for _nofail_ mount option in case the external drive is not plugged in at boot time?

---

<div class="post-metadata">

**Author:** ![s4ndm4n](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/s4ndm4n/32/70472_2.png) [@s4ndm4n](https://forum.endeavouros.com/u/s4ndm4n)\
**Post date:** [October 14, 2021, 6:42pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/7 "2021-10-14T18:42:10Z")

</div>

Do you mean the files created when USB drives get auto mounted? That’s because `/run/media` is the default for automounting. That’s why @dalto said it’s not a good place to create persistent mount points.

---

<div class="post-metadata">

**Author:** ![dalto](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/dalto/32/5577_2.png) [@dalto](https://forum.endeavouros.com/u/dalto)\
**Post date:** [October 14, 2021, 6:42pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/8 "2021-10-14T18:42:47Z")

</div>

> [@keybreak](#):
>
> why then auto-mounts like KDE creates as

because those are temporary

> [@pebcak](#):
>
> Using systemd.mount, isn’t there any need for _nofail_ mount option in case the external drive is not plugged in at boot time?

No, systemd-automounts are mounted on access and never cause problems with booting.

---

<div class="post-metadata">

**Author:** ![s4ndm4n](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/s4ndm4n/32/70472_2.png) [@s4ndm4n](https://forum.endeavouros.com/u/s4ndm4n)\
**Post date:** [October 14, 2021, 6:43pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/9 "2021-10-14T18:43:42Z")

</div>

Timeout take care of that. After 10s it lets the boot continues. It doesn’t hold up the entire boot if the drive is missing or broken or not mounted.

---

<div class="post-metadata">

**Author:** ![pebcak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/pebcak/32/100472_2.png) [@pebcak](https://forum.endeavouros.com/u/pebcak)\
**Post date:** [October 14, 2021, 6:44pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/10 "2021-10-14T18:44:27Z")

</div>

> [@dalto](#):
>
> systemd-automounts are mounted on access

I get it! Thanks!

---

<div class="post-metadata">

**Author:** ![dalto](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/dalto/32/5577_2.png) [@dalto](https://forum.endeavouros.com/u/dalto)\
**Post date:** [October 14, 2021, 6:44pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/11 "2021-10-14T18:44:47Z")

</div>

> [@s4ndm4n](#):
>
> Timeout take care of that. After 10s it lets the boot continues.

Are you sure? I have never seen mine pause boot for the timeout window when the device isn’t connected.

---

<div class="post-metadata">

**Author:** ![s4ndm4n](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/s4ndm4n/32/70472_2.png) [@s4ndm4n](https://forum.endeavouros.com/u/s4ndm4n)\
**Post date:** [October 14, 2021, 6:46pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/12 "2021-10-14T18:46:00Z")

</div>

happened to me twice after our electricity decided to play hide and seek. 😃

---

<div class="post-metadata">

**Author:** ![Jmagick](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/jmagick/32/41523_2.png) [@Jmagick](https://forum.endeavouros.com/u/Jmagick)\
**Post date:** [October 14, 2021, 10:29pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/13 "2021-10-14T22:29:21Z")

</div>

A very good tutorial! 👍 Didn’t know about the systemd entries and I’ve been doing this for a number of years.

Just a thought… for old users like me and new users to linux, how about a tutorial section in the forum.  
I’ve read the wiki but sometimes may not be enough detailed information. A step by step tut would come in handy.

And btw way more personal! 🤝 😉

---

<div class="post-metadata">

**Author:** ![Jmagick](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/jmagick/32/41523_2.png) [@Jmagick](https://forum.endeavouros.com/u/Jmagick)\
**Post date:** [October 14, 2021, 11:40pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/14 "2021-10-14T23:40:01Z")

</div>

Yep… replying to myself. 🤣 Did a quick search for tutorials and found this - [https://forum.endeavouros.com/t/why-dont-we-have-a-place-for-tutorials/17098](https://forum.endeavouros.com/t/why-dont-we-have-a-place-for-tutorials/17098)

It was marked as a solution.  
It’s very hard to ask questions, get answers and advise from Wikis.

I find forums can be be a more helpful (personal) place to get help.

Again… Just a thought…

---

<div class="post-metadata">

**Author:** ![NoobarDanu](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/n/cab0a1/32.png) [@NoobarDanu](https://forum.endeavouros.com/u/NoobarDanu)\
**Post date:** [October 14, 2021, 11:47pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/15 "2021-10-14T23:47:35Z")

</div>

(post deleted by author)

---

<div class="post-metadata">

**Author:** ![Celty](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/celty/32/34777_2.png) [@Celty](https://forum.endeavouros.com/u/Celty)\
**Post date:** [October 15, 2021, 2:25am UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/16 "2021-10-15T02:25:57Z")

</div>

Nothing gave me as much headache as auto-mounting drives with the appropriate permissions when I first switched to Linux. I’m sure a lot of newcomers will find this useful.

---

<div class="post-metadata">

**Author:** ![s4ndm4n](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/s4ndm4n/32/70472_2.png) [@s4ndm4n](https://forum.endeavouros.com/u/s4ndm4n)\
**Post date:** [October 15, 2021, 5:59am UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/17 "2021-10-15T05:59:08Z")

</div>

> [@Jmagick](#):
>
> Just a thought… for old users like me and new users to linux, how about a tutorial section in the forum.

As you found out later on I already asked the question 😃 . But I marked the thread as solved because of @Bryanpwo’s answer. And at the time I was the only one seeing the need so after big boss said that it’s pointless to argue ;P. But they will look into it if enough people from the community ask for something like that. Most of the tutorial stuff posted here will be added to the WiKi because most of the writers are from the WiKi contributor community.

> [@Jmagick](#):
>
> I’ve read the wiki but sometimes may not be enough detailed information. A step by step tut would come in handy.

Can you elborate on this one. You want a step by step on istalltion? or?

> [@NoobarDanu](#):
>
> I set run/media as the mount point… is there a way to undo this and set that folder back to tmp like it was originally?

Setting the mount point to `/run/media` won’t going to break your system. But it’s being a temporary file system the data inside of it is not persistent. If you’ve used `/run/media` to perma mount a drive using `fstab`. Then just point the mount point path in `fstab` to you `/tmp` folder.

Ex:

```auto
UUID=<UUID of your external device> /tmp <file system Ex: ext4> noatime,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=1min 0 2

```

If you have used the `mount` command to mount it the just unmount the drive using `sudo umount <device|directory>` and then mount the drive back to `/tmp` .

---

<div class="post-metadata">

**Author:** ![dalto](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/dalto/32/5577_2.png) [@dalto](https://forum.endeavouros.com/u/dalto)\
**Post date:** [October 15, 2021, 1:32pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/18 "2021-10-15T13:32:19Z")

</div>

> [@NoobarDanu](#):
>
> I set run/media as the mount point… is there a way to undo this and set that folder back to tmp like it was originally?

Putting a permanent mount in `/tmp` is probably no better or worse than putting it in `/run/media`. Those are both temporary locations typically mounted on a tmpfs.

---

<div class="post-metadata">

**Author:** ![Jmagick](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/jmagick/32/41523_2.png) [@Jmagick](https://forum.endeavouros.com/u/Jmagick)\
**Post date:** [October 16, 2021, 1:13am UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/19 "2021-10-16T01:13:32Z")

</div>

> [@s4ndm4n](#):
>
> Can you elborate on this one. You want a step by step on istalltion? or?

Let me think on this for awhile. Okay?

btw… I’ve not been this intrigued in a forum in years.

---

<div class="post-metadata">

**Author:** ![NoobarDanu](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/n/cab0a1/32.png) [@NoobarDanu](https://forum.endeavouros.com/u/NoobarDanu)\
**Post date:** [October 18, 2021, 11:53pm UTC](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688/20 "2021-10-18T23:53:45Z")

</div>

(post deleted by author)

[Next page](https://forum.endeavouros.com/t/tutorial-how-to-permanently-mount-external-internal-drives-in-linux/18688.md?page=2)
