You are not logged in.
I recently set up a little home server for me with a 256 GB drive for the OS and 4 TB drive for the actual data. I use btrfs and honestly it works so far and maybe I should change a thing about it.
I set up the 4 TB drive not in /mnt but in /srv, specifically in /srv/data where I directly mount the subvolumes like "backup", "media", or "music". I also have a subvolume container in /srv which is on the smaller drive and is the home folder of my Podman account.
I also set up udisk2 so external drives I use for backup are mounted in /media instead of /run/media/<user> simply because when I want to access them via ssh, /media is shorter. In the Arch Wiki entry for udisks2 it was recommended to create /media via /etc/tmpfiles.d.
And then I remember, that I created the mountpoints in /srv just with mkdir.
Now I wonder, would it be better to "recreate" the mountpoints with /etc/tmpfiles.d/server.conf. What would be the advantage to use tmpfiles.d instead of just mkdir, what would be the disadvantages?
I tried to search for that answer but all I able to find is the man page for tmpfiles.d
So any help to understand this better would be really helpful.
Offline
Did you mean this wiki?
# /etc/tmpfiles.d/media.conf
D /media 0755 root root 0 -This (Example 5) suggests /media will be created or emptied on boot. Though the documentation on "Age" says:
When the age is set to zero, the files are cleaned unconditionally.
(So I'm not sure if it's cleaned any time besides boot, because there is systemd-tmpfiles-clean.timer)
Anyway, the difference seems to be using tempfiles.d will automatically clean up the mount point (directories) created by udisks2 in /media/, whereas mkdir is persistent.
However, doesn't udisks2 automatically clean up mount points? (On my DE it does)
P.S.
There is also systemd.mount (example)
Where=
If the mount point does not exist at the time of mounting, it is created as either a directory or a file.
But it doesn't delete the mount point when the unit is stopped or disabled.
Last edited by Beemo (2026-10-04 14:08:32)
Online
Hijacking the post a bit:
I don't use systemd-tmpfiles so I don't really know, but... Isn't the advice on the wiki a bit dangerous?
If the udisks2 service has already mounted something in /media/ by the time systemd-tempfiles-clean.service is run, wouldn't it delete everything in the mounted folder...?
# /etc/tmpfiles.d/media.conf
D /media 0755 root root 0 -d
Create a directory. The mode and ownership will be adjusted if specified. Contents of this directory are subject to time-based cleanup if the age argument is specified.
D
Similar to d, but in addition the contents of the directory will be removed when --remove is used.
Age
When the age is set to zero, the files are cleaned unconditionally.
Last edited by Beemo (2026-10-04 14:28:49)
Online