You are not logged in.

#1 2019-07-04 11:00:30

TechnoJellyfish
Member
Registered: 2019-06-29
Posts: 10

[SOLVED] Best practice mounting additional (storage) partitions

I've been wondering about this topic for a while now and I've read some conflicting opinions that didn't exactly help clarifying the matter. Consider the following setup/scenario:

  1. a small SSD /dev/sda mounted on* '/'

  2. a fast medium-sized HDD /dev/sdb mounted on '/home'

  3. a large HDD /dev/sdc to be utilized as general data storage device

Now, let's say I want to make /dev/sdc availabe at '/home/example_user/Downloads'. Is it considered bad practice to mount it directly on said directory? I remember some sources not recommending this approach because of the possibility of the device being mounted on the parent directory (/dev/sdb) failing, causing the second mount operation to fail as well.

Would it be preferable to create an entirely unrelated mount point (say '/data') and create a symbolic link in the home directory pointing to it? Is it recommended to create mount points directly below '/'? If not, what's a good place to create mount points for permanent storage devices (seeing that '/mnt' and '/media' are usually used for temporary mount points and removable devices, respectively).

Are there any other options? What's the cleanest, most trouble-free way of doing this?


*Is it mounted on, to or even onto?

Last edited by TechnoJellyfish (2019-07-10 06:47:17)

Offline

#2 2019-07-04 14:56:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,499

Re: [SOLVED] Best practice mounting additional (storage) partitions

"noauto,x-systemd.automount" (this way you'll only mount the partition when accessing the path what's not gonna happen if /home /isn't mounted and the path thus doesn't exist)
You might also be interested in bind mounts.

Offline

#3 2019-07-04 15:18:06

userak
Member
Registered: 2017-02-04
Posts: 42

Re: [SOLVED] Best practice mounting additional (storage) partitions

I'm personally mounting the storage devices under "/mnt" directory and in "etc/fstab" file I have used the option "noauto,x-systemd.automount" as @seth has  pointed out.

On my system  removable storage drives are getting auto-mounted under "/run/media/" directory.

Last edited by userak (2019-07-04 15:22:24)


A newbie archlinux user ...

Offline

#4 2019-07-04 16:21:55

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Best practice mounting additional (storage) partitions

Why 3 devices? Why not have your ~ on the SSD as well, this way it gets used for all the little random reads and writes of your dotfiles every time you use an application and you are taking full advantage of the best performance attributes of the SSD.

I use this approach and then have bind mounts in my ~ for all of the data directories (docs, music, videos, downloads etc) which live on my warm storage mounted at /mnt/data (in my case this is now a network store but I used to use a local raid).

An old but relevant thread...
https://bbs.archlinux.org/viewtopic.php?id=207682


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2019-07-05 10:06:30

TechnoJellyfish
Member
Registered: 2019-06-29
Posts: 10

Re: [SOLVED] Best practice mounting additional (storage) partitions

seth wrote:

"noauto,x-systemd.automount" (this way you'll only mount the partition when accessing the path what's not gonna happen if /home /isn't mounted and the path thus doesn't exist)
You might also be interested in bind mounts.

I didn't know about systemd's mount options (there seem to be a handful of useful ones), I bet those will come in handy at some point. I totally forgot about bind mounts, that's also an option to consider.

Slithery wrote:

Why 3 devices? Why not have your ~ on the SSD as well, this way it gets used for all the little random reads and writes of your dotfiles every time you use an application and you are taking full advantage of the best performance attributes of the SSD.

I kept the initial scenario a bit vague on purpose because I was more interested in general guidelines (best practices) than solving a specific issue (fwiw, I've set up LVM, including a cache volume on the SSD).

Currently, I tend towards just mounting my storage partitions on something like '/mnt/data' and symlink to it. Seems marginally less headache-inducing than bind mounts and achieves what I have in mind, I suppose.

If people still want to add their opinions/personal practices, keep 'em coming! Otherwise, I'll mark the thread as solved in a few days. Thanks for the advice, y'all!

Offline

#6 2019-07-05 12:14:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,423

Re: [SOLVED] Best practice mounting additional (storage) partitions

Symlinks can be problematic as well if you are using something that explicitly doesn't follow symlinks, or if you ever do that anywhere else other than your home dir (in particular don't think of symlinking directories which are part of pacman packages, pacman will remove your symlink and replace it with a directory should the affected package be upgraded, potentially leading to all sorts of weird behaviour)

Last edited by V1del (2019-07-05 12:16:06)

Offline

#7 2019-07-06 05:42:10

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: [SOLVED] Best practice mounting additional (storage) partitions

What works for me is to only mount / and /home with fstab. My separate internal partition for Documents is mounted manually with  either read-only or read-write as required, (I do the same with external drives which I can mount to  folders like eg ${HOME}/Downloads as required.)

I also have a systemd timer which checks every 5 minutes  to see if a manually mounted drive is being used, and, if it's not  been used for about 10 or 15 minutes, it un-mounts it. (NOTE: you need to give the timers service executable the appropriate permission in /etc/sudoers and make sure that it is, at the very least, immutable.)

The big problem with this is that udiskctl mount, can be run by an un-priveledged user and this behaviour is hard coded into udisks2. I found the best way of getting around this is to deny access to /media and /run/media in my apparmor profile for usr.lib.udisks2.udisksd.

It doesn't actually make me completely immune to ransom-ware and the like, but it goes a long way to minimising my exposure.

Irvine

Edited because my note on etc sudoers was in the wrong paragraph smile

Last edited by IrvineHimself (2019-07-06 05:55:04)


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

#8 2019-07-06 06:12:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,499

Re: [SOLVED] Best practice mounting additional (storage) partitions

"noauto,x-systemd.automount,x-systemd.idle-timeout=10min" …

Offline

Board footer

Powered by FluxBB