Parse error fstab (SOLVED)

Hi! While I was updating the system I read this …

findmnt: /etc/fstab: parse error at line 9 – ignored

That line contains this …

UUID=38e00dce-539e-4d9c-86ac-2f36a72579e0 swap swap pri=0 defaults,noatime,discard 0 2

Does anybody have any idea what’s wrong?

Thanks in advance!

Please post the output of the following with Preformatted text </>, not Quote ":

cat /etc/fstab


lsblk -f
1 Like

There is a space between pri=0 and defaults. Spaces are field delimiters inside /etc/fstab, so there should be a comma instead of a space.

In addition to that, you’ve got too many options for your swap partition. This in itself won’t create the problem you’re seeing, but it’s futile as the swap partition does not contain a filesystem. Also, your discard option is wrong.

This below is the corrected line…:arrow_down:

UUID=38e00dce-539e-4d9c-86ac-2f36a72579e0 swap swap pri=0,discard=pages 0 2

…but do we really want discard in swap ?

‘automatic trim’ or ‘discard’ is already a bit dubious in general.

For swap particularly … I guess I will reference

SSDOptimization - Debian Wiki :

Alternatively, and often not recommended: Set “discard” mount option in /etc/fstab for the ext4 filesystem, swap partition, Btrfs, etc. See mount(8).

$ man swapon

-d, --discard[=policy]

Enable swap discards, if the swap backing device supports the discard or trim operation. This may improve performance on some Solid State Devices, but often it does not . The option allows one to select between two available swap discard policies: --discard=once to perform a single-time discard operation for the whole swap area at swapon; or --discard=pages to asynchronously discard freed swap pages before they are available for reuse. If no policy is selected, the default behavior is to enable both discard types. The /etc/fstab mount options discard, discard=once, or discard=pages may also be used to enable discard flags.

1 Like

The swap partition(s) is(/are) the exception to the rule. fstrim.timer only works on filesystems ─ and for that matter, only if they are mounted read/write, not if they are mounted read-only ─ but the swap partition doesn’t contain any filesystem, and as such, its blocks would never get trimmed.

That’s why discard=pages is recommended for the swap partition ─ it will only trim the blocks for swapped out pages when the whole page is deleted from swap again. This ensures that there will be enough blocks to trim (so that the device won’t ignore the trim request), and that it’s not trimming on every single write.

1 Like

I haven’t understood most of the things you have all said.
I’m going to read more about this because I want to understand all these options.
I changed the line and now it’s exactly what Aragorn suggested.
Everything seems to be perfect now.
Thank you all very much!!
Happy new year!!

1 Like

You’re absolutely right about the format.
It’s not the first time I make this mistake.
I’ll try to not repeat it.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.