Following the partly off-topic discussion starting around post #9 of the thread below…
… it has been brought to the attention that the Wiki page on /etc/fstab
needs some revision. Concretely, the page contains the following example of an /etc/fstab
…
# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
LABEL=ESP /boot/efi vfat umask=0077 0 2
/dev/sda5 / ext4 defaults,noatime,discard 0 1
UUID=18360b04-a96d-4a99-8323-b07717f36a31 swap swap defaults,noatime,discard 0 0
UUID=b4108631-e051-48d8-b2ff-a1d924a893f1 /home ext4 defaults,noatime,discard 0 2
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2
The two problematic — read: incorrect — entries in the example file are the following…
UUID=18360b04-a96d-4a99-8323-b07717f36a31 swap swap defaults,noatime,discard 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
And here’s why they are wrong…
The first incorrect line here-above is a line for a swap partition. The mount options for that swap partition should not contain the option noatime
, because noatime
is a mount option that tells the filesystem not to update the time of last access on an inode
unless the mtime
is also modified. So far so good, but the reason why this option is wrong is that a swap partition does not contain any filesystem — the kernel accesses the raw drive blocks — and that therefore, there are no inodes
.
Does this mount option cause any harm? No, it doesn’t, but for a swap partition it’s an incorrect one nevertheless. The same is true for swap files, by the way.
The second incorrect line here-above is for mounting a tmpfs
to /tmp
. This line is redundant, because Manjaro uses systemd
as the init
system and service manager, and in all systemd
-based Arch-derivatives — as well as in Debian and its derivatives, and in RedHat and its derivatives — systemd
itself already mounts a tmpfs
at /tmp
. (openSUSE and SUSE proper are the only two systemd
-based exceptions that I know of.)
Therefore, having an entry for /tmp
in /etc/fstab
will cause this entry to mount another tmpfs
at /tmp
, thereby obscuring the first tmpfs
that was already mounted there by systemd
, possibly leading to a small loss of total available memory if something was already parked in /tmp
before /etc/fstab
is processed. Not exactly a tragic mistake on today’s systems with many GiB of RAM, but nevertheless an incorrect setup.
Furthermore, the example for /tmp
also references the mode=1777
mount option. While tmpfs
does support this mount option, it is again redundant, given that the /tmp
directory is by default created with 1777
permissions — i.e. drwxrwxrwt
— and that tmpfs
is a POSIX-compatible virtual-memory filesystem. As such, when a tmpfs
is mounted to a directory with 1777
permissions, the root directory of the tmpfs
will inherit the 1777
permissions of the directory it is mounted to.
Conclusion
-
The entry for the swap partition in the
/etc/fstab
example should be edited to only contain either the mount optiondefaults
or the mount optionswap
— but not both at the same time — possibly added with the optiondiscard=pages
to allow for aTRIM
operation, becausefstrim.timer
does not normally cover the swap partition, given that thefstrim
command only works on read/write-mounted filesystems, and the swap partition does not contain any filesystem. -
The entry for
/tmp
should be removed altogether from the/etc/fstab
example. -
Optional: The example on the Wiki page also contains a sample entry for an NTFS filesystem, to be mounted at
/media/Data
. Due toudisks2
auto-mounting removable storage and non-system filesystems alike under/run/media
or/run/user
, the directory/media
does not exist by default anymore — i.e. the user would have to create it themselves (with superuser privileges, because it’s a root-level directory) — and I would also recommend against using uppercase characters for anything outside of the user’s own$HOME
. So perhaps make it into/media/data
, and add a note to the article that neither/media
nor/media/data
exist by default, and must be explicitly created with…
sudo mkdir -p /media/data
Lastly, I am posting this thread in Wiki because I’m not a Wiki editor, and apart from one of my fellow moderators — who happens to be too busy to concern himself with editing the Wiki or monitoring the forum right now — I don’t know who the other community members with Wiki editor access are. So hopefully one of them will pick up this thread and correct the article.