I have Ubuntu 18.04 server with 500G SSD disk which has LVM and dm-crypt on it.
I recently noticed that the number of bytes written to disk (as reported by
vmstat -d or
iostat) is unrealistically high. After monitoring the system I/O I found that the giant spike in disk writes happens once a week when
From the logs, it looks like every week when
fstrim runs it reports that basically all free space was written to the disk, even though the system is almost at idle and has just under 10Gb written in a week at most.
Is this an expected behavior? I always thought that only new free blocks since last
fstrim run should be discarded, but not the entire free space each time. This puts absurdly high wear on SSD (judging by media wearout value as reported by disk). Or is it somehow related to the presence of
The disk does support TRIM:
hdparm -I /dev/sda | grep TRIM * Data Set Management TRIM supported (limit 8 blocks) * Deterministic read ZEROs after TRIM
And discard pass through is also enabled in
dmsetup table silverbox--vg-swap: 0 19529728 linear 253:0 917964800 silverbox--vg-root: 0 917962752 linear 253:0 2048 sda3_crypt: 0 937496576 crypt aes-xts-plain64 00...0 0 8:3 4096 1 allow_discards