Description of problem: systemd-fstab-generator ignores the 'discard' mount option in /etc/fstab for swap partitions. Additionally, there is no syntax in the systemd.swap unit files to specify this feature. Version-Release number of selected component (if applicable): systemd-201-2.fc18.7.x86_64 How reproducible: always Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: It's an open question how to actually tell if a swap partition is using 'discard' (not systemd-specific). It's definitely the case that the option is not reflected in the unit file.
If the dmesg results are to be believed, I think this is the difference between 'discard' and 'no discard' (see the 'D' flag): # swapon /dev/disk/by-uuid/d8e4b4bf-9f1e-446a-a5b0-0325c4ef7d73 # dmesg | grep swap | tail -1 [773331.002898] Adding 8388604k swap on /dev/mapper/M4_CT256_AF15-scruffy_f18_swap. Priority:-1 extents:1 across:8388604k SS # swapon --discard /dev/disk/by-uuid/d8e4b4bf-9f1e-446a-a5b0-0325c4ef7d73 # dmesg | grep swap | tail -1 [773346.691092] Adding 8388604k swap on /dev/mapper/M4_CT256_AF15-scruffy_f18_swap. Priority:-1 extents:1 across:8388604k SSD More importantly, my /etc/fstab lists that partition with the 'discard' option, and at boot time the option is ignored (presumably because of systemd): # dmesg | grep swap | head -1 [ 2.527089] Adding 8388604k swap on /dev/mapper/M4_CT256_AF15-scruffy_f18_swap. Priority:-1 extents:1 across:8388604k SS So this is more of a general systemd/bootup problem.
As per http://cgit.freedesktop.org/systemd/systemd/tree/src/core/swap.c this is not currently a supported feature in systemd.
(In reply to Carl Roth from comment #1) > If the dmesg results are to be believed, I think this is the difference > between 'discard' and 'no discard' (see the 'D' flag): Found it at http://lxr.free-electrons.com/source/mm/swapfile.c?v=3.9#L2136
Does "swapon -a" read this from fstab? We should probably support the same syntax.
(In reply to Lennart Poettering from comment #4) > Does "swapon -a" read this from fstab? We should probably support the same > syntax. Yes, see https://git.kernel.org/cgit/utils/util-linux/util-linux.git/tree/sys-utils/swapon.c#n640
http://cgit.freedesktop.org/systemd/systemd/commit/?id=86b23b07c96b185126bfbf217227dad362a20c25 http://cgit.freedesktop.org/systemd/systemd/commit/?id=4f52d3fe2da7c3449b7fbfaa7c64a83354d3b56c http://cgit.freedesktop.org/systemd/systemd/commit/?id=cdc8982030271785d650af410230397bbb5a4be9 http://cgit.freedesktop.org/systemd/systemd/commit/?id=4afbccded23f5144e39a7f7b243393799186ba39