Linux drive automount point path conventions

1

1

Like many I have several physical disks installed in my system and I set them up to be constantly mounted to some paths. I want to find a conventional general approach to it.

In my experience I've come across several conventions on that matter:

  1. /[DriveName]
  2. /mnt/[DriveName]
  3. /Volumes/[DriveName] - OSX
  4. Any path you like

The first approach seems to be polluting the root namespace. The second uses a directory supposed to be used for temporary mounts AFAIK. The third is alien to Linux world. The fourth is just chaotic.

I lean to the /mnt/[DriveName] approach but I have some doubts. Also I thought that /disks/[DriveName] or /volumes/[DriveName] could be nice but I haven't found such a convention.

Please name a preferred convention on that matter.

Nikita Volkov

Posted 2012-04-26T14:39:27.040

Reputation: 222

Answers

2

The Linux Filesystem Hierarchy says that /media is for

subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks.

and /mnt is

provided so that the system administrator may temporarily mount a filesystem as needed.

I often find it convenient to have a temporary mounting point /mnt available, and therefore I don't create any sub-directories or such there.

Internal drives are perhaps not to be considered "removable", but since /media can hold a bit of everything concerning the mounting department, I use that for internal drives as well.

All of the LFS are just common recommendations and perhaps best practices, so whatever suits you is fine, within reasonable bounds. Personally it suits me best to use /mnt for very temporary mounts (loopback disc images, foreign USB drives) and /media for more stable mounts.

Since extra disks today often in practice holds just "media" (movies/music/etc), I find it quite mnemonic as well :-) .


To directly address your points:

1. /DriveName

The document I linked on the Linux filesystem hierarchy mentions your consideration regarding polluting /:

Placing the mount points for all removeable media directly in the root directory would potentially result in a large number of extra directories in /.

, which is implied to be something that should be avoided.

2. /mnt/DriveName

See earlier discussion.

3. /Volumes

Very un-Linux-y in my eyes, but of course it works.

4. "Any path you like"

In practice "yes", but why would one not like to have them mounted in an organized manner?


Regarding mount names, I would also suggest to at least avoid naming them e.g. /media/sdb1 and so on, since this is not really a partition specific parameter (as UUID already addresses). Personally, I use a combination of a personally assigned ID number and the partition size, such as /media/5-2000. The partition specific unique ID enables me to tab complete by a single number after /media/. But this is all discussion on very individual preferences, so I'll stop here.

Daniel Andersson

Posted 2012-04-26T14:39:27.040

Reputation: 20 465

Oh, media... Forgot about that ) Yes, your solution seems to be pretty reasonable. I'll accept it as an answer if no one has it beaten any time soon. Thanks! – Nikita Volkov – 2012-04-26T15:02:17.260

There's a bit of a problem. The partitions mounted to the /media/... path get listed in the unmountable list in Nautilus. I think that's because of /media/... being implied to be used for temporary mounts only. So this solution opens other issues, sigh. – Nikita Volkov – 2012-04-26T17:08:44.820

@mojojojo: I don't use Nautilus, but are you sure it looks for directories in /media and not just mounted partitions similar to the df output? Also, what is the problem with the disks appearing in this "unmountable list"? (and "unmountable" sounds like "impossible to mount", but I guess you mean "possible to umount", which disks like these are). In a way, I find that to be very correct, since these disks are supposed to be possible to umount - they should not have any system files on them and so on. In that case that partition should be mounted as /usr or the like. – Daniel Andersson – 2012-04-27T06:01:06.877

As I said before the point of this operation was to make those partitions mounted permanently. This would imply that symlinking to paths on them would be safe and stuff. I don't want to unmount them ever. Think of that as if you had a partition mounted to say a /home folder - would you want it to be possible to unmount? Now I have a lot of those partitions and when they appear in the same lists as temporarily inserted flash drives, they firstly become easy to unmount by accident and secondly make working with those flash drives harder. Btw, Ubuntu also displays those partitions in launcher. – Nikita Volkov – 2012-04-27T12:01:52.257

@mojojojo: But is this really dependent on them being mounted in /mount? Doesn't Nautilus, etc. just list all mounted drives? Anyway, it's more of a privilege problem than anything else: specify that only root is allowed to mount/unmount (isn't this the default?) and you won't do it by mistake, even if the cat walks on the keyboard. – Daniel Andersson – 2012-04-27T12:11:03.200

It is really dependent on partitions being mounted to /media - here are some proofs: http://ubuntuforums.org/showpost.php?p=6640389&postcount=2, http://askubuntu.com/a/22218/21338. So basically it all boils down to either mount them to /media/[Name] and do a bunch of unconventional configuration or just mount them to /mnt/[Name]. I think we have a winner here.

– Nikita Volkov – 2012-04-27T14:04:57.080

@mojojojo: Whatever suits you, of course. I don't see the unmounting risk you describe with /media (but I don't use the same tools as you), so /media suits me and my /mnt usage. – Daniel Andersson – 2012-04-27T15:10:33.453

Thanks, Daniel. It's a pity though we haven't found any strict convention. I think there's a huge lack of them in Linux world because currently "Whatever suits you" is a prevalent answer on too many subjects. – Nikita Volkov – 2012-04-27T17:47:39.863

@mojojojo: The curse of choice :-) – Daniel Andersson – 2012-04-27T17:55:46.167