4

I have an SSD with 2 partitions formatted with ext4. On the second partition, I enabled discard as a default option at the filesystem level with this command:

$ sudo tune2fs -o discard /dev/sda2
tune2fs 1.45.5 (07-Jan-2020)
$ sudo tune2fs -l /dev/sda2 | grep 'mount options'
Default mount options:    user_xattr acl discard

I also added the discard option to both partitions on /etc/fstab:

/dev/sda2 /     ext4 rw,relatime,discard,stripe=8191 0 1
/dev/sda1 /boot ext4 rw,relatime,discard,stripe=8191 0 2

However, when I look into the output of mount, only the one without the discard fs-level default mount option seems to have it enabled:

$ mount | grep '^/dev'
/dev/sda2 on / type ext4 (rw,relatime,stripe=8191)
/dev/sda1 on /boot type ext4 (rw,relatime,discard,stripe=8191)

I notice that the other options mentioned by tune2fs are also not mentioned.

So, can I trust that discard is enabled in the current mount of /dev/sda2 despite mount not mentioning it? Is there some way to verify it? I mean, even tune2fs's output isn't about the current mount.

EDIT: I should mention that I also tried mounting with mount -o discard in the command line and it still doesn't show in mount output:

$ sudo tune2fs -o discard /dev/sda1
tune2fs 1.45.5 (07-Jan-2020)
$ sudo umount /boot
$ sudo mount -o discard /boot
$ mount | grep sda1
/dev/sda1 on /boot type ext4 (rw,relatime,stripe=8191)
JoL
  • 4,520
  • 15
  • 35

1 Answers1

5

/proc/mounts and mount don’t show settings which are included in the default settings, including defaults set in the file system options using tune2fs, so unfortunately this is normal.

To determine whether discard is enabled, you need to check the defaults, check the mount options, and combine the two sets of information.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164