this post was submitted on 04 Jul 2024
74 points (97.4% liked)

Linux

48371 readers
1621 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Where should I mount my internal drive partitions?

As far as I searched on the internet, I came to know that

/Media = mount point for removable media that system do it itself ( usb drive , CD )

/Mnt = temporarily mounting anything manually

I can most probably mount anything wherever I want, but if that's the case what's the point of /mnt? Just to be organised I suppose.

TLDR

If /mnt is for temporary and /media is for removable where should permanent non-removable devices/partitions be mounted. i.e. an internal HDD which is formatted as NTFS but needs to be automounted at startup?

Asking with the sole reason to know that, what's the practice of user who know Linux well, unlike me.

I know this is a silly question but I asked anyway.

top 50 comments
sorted by: hot top controversial new old
[–] atzanteol@sh.itjust.works 22 points 4 months ago* (last edited 4 months ago) (1 children)

With Linux filesystem hierarchies you're going to run into a lot of history, conventions, quasi-standards and simply deprecated implementations.

It's a problem of "there's no bad way to do it so all options are equally fine". From this arose some "guidelines" about /bin and /usr/bin, /var, etc. but few strict rules.

For a long time there was no /media. In the '90s/2000's you would mount your CD-ROM and floppies in /mnt (e.g. /mnt/cdrom, /mnt/floppy). That was awkward as we started wanting auto-mounted things and wanted to do it from user-space. So /media/username was created to allow you to mount things with your ownership.

If it's something you want permanently mounted but not part of a pool you can put it under any location you like really. I like locations under /var as historically /var is used for things that "vary". You could just mount it in your $HOME if it's something you're going to use as a user rather than with a service.

I have a "/exports" dir for NFS mounts (e.g. /export/media, /export/storage, etc.). Just keeps it tidy and in one location.

The important thing is to use a standard that works for you and makes sense. There's not a lot of bad places to mount things. If "/mnt" makes sense for you then go for it.

[–] gpstarman@lemmy.today 6 points 4 months ago
[–] cmnybo@discuss.tchncs.de 15 points 4 months ago (1 children)

Anything I add to fstab gets mounted in /mnt and removable drives get auto mounted to /media. Linux doesn't care where you mount your drives, they can be mounted anywhere you want.

[–] gpstarman@lemmy.today 6 points 4 months ago

Linux doesn't care where you mount your drives, they can be mounted anywhere you want.

Thank You

[–] GnuLinuxDude@lemmy.ml 14 points 4 months ago (11 children)

It ultimately doesn't actually matter because in many cases these things are convention and there is no real system-based effect. So while it would be especially weird if your distro installed packages into those directories, it ultimately doesn't matter. Someone already linked the filesystem hirearchy. See how tiny the /media and /mnt sections are?

I put my fixed disks into subdirectories under /mnt and I mount my NAS shares (I keep it offline most of the time) in subdirectories in /media.

load more comments (11 replies)
[–] wargreymon@sh.itjust.works 11 points 4 months ago* (last edited 4 months ago) (1 children)

The best mounting position is /booty.

[–] gpstarman@lemmy.today 7 points 4 months ago

Thank You for suggestion. Gonna try that Tonight and have fun mounting loads of data.

[–] CMDR_Horn@lemmy.world 8 points 4 months ago (1 children)

Basically if I add it to my fstab it goes to /mnt. I let the system handle /media for usb etc

load more comments (1 replies)
[–] rotopenguin@infosec.pub 8 points 4 months ago (1 children)
[–] gpstarman@lemmy.today 5 points 4 months ago (2 children)

You mean that you create folder in / named C:?

or a joke maybe?

[–] atzanteol@sh.itjust.works 8 points 4 months ago

Seems like a joke. 🙂

[–] MonkderDritte@feddit.de 5 points 4 months ago* (last edited 4 months ago) (4 children)

I mean, wine does that with symlinks. But not on /, don't run wine as root.

load more comments (4 replies)
[–] MrSoup@lemmy.zip 7 points 4 months ago* (last edited 4 months ago) (5 children)

The Linux FHS does not address this, so it's up to you where to mount it. There is no correct choice, but if you want to follow standards just mount it inside /mnt which is the nearest use-case (/media could be automatically used by your DE, so avoid it). Otherwise you can just create a custom folder in root like someone else suggested.

Take a look at FHS spec.

Edit:
On arch forum someone suggests /mnt/data

load more comments (5 replies)
[–] Revan343@lemmy.ca 7 points 4 months ago* (last edited 4 months ago)

Mounting locations are a convention, not a standard, mount whatever you like wherever you like. In your case, I'd mount it under /mnt/ntfs, /mnt/windows if it a windows main partition you want visible, or by drive letter if it's a secondary drive on a dual-boot system.

Or however you want. I would keep it under /mnt, but you don't have to.

Do maybe sure you have user permissions set up properly if this is a multiuser machine though

Edit: also I would interpret

If /mnt is for temporary

'temporary' as in 'may become unmounted without seriously fucking the system'

/ and /home aren't temporary. Everywhere else is

[–] SimplyTadpole@lemmy.dbzer0.com 7 points 4 months ago

Use any you want. I've been mounting my internal secondary hard drive on /mnt for well over a year now and haven't had any problems. Previously, I mounted it on ~/Storage and it also worked fine (though only because I'm the only user in my computer; dual-user systems would result in the other user being unable to access the hard drive).

[–] lazylion_ca@lemmy.ca 7 points 4 months ago (4 children)

I create /data and mount my 2nd drive there using fstab.

I then mount /data/downloads under my user downloads folder so everything goes to my 2nd drive. That way I dont have to redownload anything if I redo my main drive.

[–] gpstarman@lemmy.today 4 points 4 months ago

Good idea bro.

load more comments (3 replies)
[–] bjoern_tantau@swg-empire.de 6 points 4 months ago (1 children)

There's also /run/media/[username]/. Don't know if it's an OpenSUSE thing or Plasma but everything I mount through KDE's file manager Dolphin ends up there. Including stuff I set up to mount automatically.

load more comments (1 replies)
[–] Rudee@lemmy.ml 5 points 4 months ago (1 children)

Not a pro by any means, but I mount my internal drives at /mnt. Its also where I mount my NAS

AFAIK mount point doesn't matter

load more comments (1 replies)
[–] Presi300@lemmy.world 5 points 4 months ago

Idk, I mount my disks in /mnt/whatever, though I don't think it matters where you mount them.

[–] GuyNoIRQ@infosec.pub 4 points 4 months ago (2 children)

If I remember correctly mnt is for static media that you expect to always be present and media is for removable media which may come and go.

load more comments (2 replies)
[–] Pika@sh.itjust.works 4 points 4 months ago* (last edited 4 months ago) (1 children)

Actually since their permanent non-removable drives, I would say wherever you want to place them, if they're meant primarily for storing user-based data you can do like what I used to do which was store them in within the home directory just as specific names. Like my old setup before I went proxmox was /backups was my backup drive, /home was my home drive that stored most of my users /home/steam held all my game server drive and /home/storage held my long term cold storage drive.

load more comments (1 replies)
[–] exu@feditown.com 4 points 4 months ago (1 children)

I use multiple subdirectories under /mnt for my fstab/systemd-mount managed disks. That includes local and network locations.

[–] gpstarman@lemmy.today 2 points 4 months ago (1 children)

But isn't anything under /mnt is defaulted to root as owner?

[–] exu@feditown.com 3 points 4 months ago* (last edited 4 months ago) (1 children)

Yeah, but you need root anyways to mount disks (most of the time), so doing a quick chown isn't that much effort.

Edit: chown > chmod

load more comments (1 replies)
[–] bloodfart@lemmy.ml 3 points 4 months ago (1 children)

Unless dictated by the particular data in the disks, /mnt is generally used for system managed volumes and /media is used for user managed volumes.

If you do something else, stick with it so you don’t get confused.

load more comments (1 replies)
[–] Sonotsugipaa@lemmy.dbzer0.com 3 points 4 months ago (1 children)

I decided to simply create directories within /mnt, chmod 000 them and use them as fixed mountpoints;
for manual temporary mounts I have /mnt/a, /mnt/b, ... /mnt/f, but I never needed to use more than two of them at once.

While this setup doesn't really respect the filesystem hierarchy, I wouldn't have used /mnt at all if I were constrained by its standard purpose since having one available manual mountpoint seems pretty limiting to me.
Then again, I have 3 physical drives with ~ 10 partitions, plus one removable drive with its own dedicated mountpoint...

[–] gpstarman@lemmy.today 2 points 4 months ago (7 children)

chmod 000

What does this do? I'm a Meganoob.

Fixed mountpoints

?

having one available manual mountpoint

you mean the whole /mnt is meant to single mount point?

Sorry for all the questions.

[–] ShittyBeatlesFCPres@lemmy.world 3 points 4 months ago (1 children)

chmod is the command to change user permissions. The numbers mean user, group, and others and the value allows read, write, execute. So, 000 means no one has permissions to get rid of the mount point. 777 means everyone has all permissions. (4 is read, 2 is write, and 1 is execute and the numbers are added. So, 644 would mean you can read/write, the group and other users have read only access.)

You don’t have to use the numbers but eventually, almost every Linux admin does because it’s faster, a bit like a keyboard shortcut. But, for instance, you can add Execute permission with chmod +x /some/file/location.

Here’s more details on the how to chmod and the historic reasons for the 0-7 system (spoiler: it’s 8 bits): https://www.redhat.com/sysadmin/linux-file-permissions-explained

[–] gpstarman@lemmy.today 2 points 4 months ago (1 children)

Thank You for the detailed answer.

chmod vs chwon ?

[–] ShittyBeatlesFCPres@lemmy.world 3 points 4 months ago (1 children)

chown changes the file owner. chmod changes permissions. So, if a file or directory is owned by root but a user should have access, you could make them the owner or you could keep root the owner and just allow read/write access.

They come up more on servers where you often have multiple users with different access levels. Some users might not have sudo permission but do have full control over their home directory and whatever else they need. And web servers, for instance, will usually have a user called www-data or similar and it’s shared by all the users in the “developer” group.

load more comments (1 replies)
load more comments (6 replies)
[–] nyan@sh.itjust.works 3 points 4 months ago

As far as I'm concerned, everything goes under /mnt , and has for the past 18+ years.

[–] Kelo@lemmy.world 3 points 4 months ago (1 children)

I myself have separate /Disks folder where I mount all my internal disks on boot. Not sure how "standard" such setup is, but it helped me keep my NTFS and Linux disks tidy and out of my way. For what I know you can mount your drives anywhere you like

load more comments (1 replies)
load more comments
view more: next ›