Skip to main content
Topic: nodiscard option is not honoured while mounting journaling file systems like ext (Read 6144 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

nodiscard option is not honoured while mounting journaling file systems like ext

I have put nodiscard option in my /etc/fstab file for mounting of ext4 partitions. Basically I will have a cron job that will periodically issue trim command to the ssd. However on checking it seems that the partitions are not mounted with nodiscard option. Please see the output given below. How can I get the ext4 partitions mounted with nodiscard option?

Code: [Select]
$ mount -v --types ext4
/dev/nvme0n1p1 on / type ext4 (rw,relatime,lazytime)
/dev/nvme0n1p2 on /home type ext4 (rw,relatime,lazytime)
$
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>            <mount point>  <type>  <options>  <dump>  <pass>
UUID=XXXXXXX                     /          ext4    lazytime,nodiscard,defaults  0 1
UUID=XXXXXXX1                    /home          ext4    lazytime,nodiscard,defaults  0 2
$


Re: nodiscard option is not honoured while mounting journaling file systems like ext

Reply #1
I wouldn't worry too much since man 5 ext4 says nodiscard is the default.

I'd put defaults first on fstab though, or see if mount -o remount,nodiscard / changes the output of mount.

Re: nodiscard option is not honoured while mounting journaling file systems like ext

Reply #2
Is there a command apart from mount or some script that can check whether a ext4 partition is mounted with the nodiscard option?

I removed the defaults options and then gave nodiscard and one additional dummy option, nombcache. The nombcache option was given just to test out whether it is accepted or not. The same result, nodiscard was not shown in the mount. Please see the output given below for more details


Code: [Select]
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>            <mount point>  <type>  <options>  <dump>  <pass>
UUID=XXXXXXX                    /          ext4    lazytime,nodiscard,nombcache  0 1
UUID=XXXXXXX1                   /home          ext4    lazytime,nodiscard,nombcache  0 2

$ mount -v -types ext4
/dev/nvme0n1p1 on / type ext4 (rw,relatime,lazytime,nombcache)
/dev/nvme0n1p2 on /home type ext4 (rw,relatime,lazytime,nombcache)
$

Re: nodiscard option is not honoured while mounting journaling file systems like ext

Reply #3
I'm at my Linux machine now and tried four mounts, one with discard, one with nodiscard, one with exec and one with noexec. discard and noexec are shown in mount options; nodiscard and exec aren't.

So yeah, mount options that are redundant with fs defaults aren't mentioned. I'm not aware of any tool that can list them all.

Re: nodiscard option is not honoured while mounting journaling file systems like ext

Reply #4
Thanks @capezotte‍