On 21/01/2019 05.01, Andrei Borzenkov wrote:
21.01.2019 0:17, Carlos E. R. пишет:
On 20/01/2019 20.15, Andrei Borzenkov wrote:
20.01.2019 22:11, Matthias Bach пишет:
...
Please post output of
dmsetup table
on system where you see "working" discard. I suspect this is false positive.
I'm getting curious. I have two machines in which home is encrypted and on SSD disks. Using that command I get:
Laptop with encrypted home on SSD:
Legolas:~ # dmsetup table cr_sda8: 0 976746496 crypt aes-xts-plain64 0000000000000000000000000000000000000000000000000000000000000000 0 8:8 4096 Legolas:~ #
Small server with encrypted home on mSATA SSD
sengard:~ # dmsetup table ... ... cr_home: 0 146798592 crypt aes-xts-plain64 0000000000000000000000000000000000000000000000000000000000000000 0 8:5 4096 ... Isengard:~ #
Discard is not active.
The log has entries like this:
# grep -i "discard\|trim" /var/log/messages
small server:
...
<3.6> 2018-12-26 11:05:47 Legolas fstrim 1134 - - /: 19.3 GiB (20749635584 bytes) trimmed <3.6> 2018-12-26 11:05:47 Legolas systemd 1 - - Started Discard unused blocks. <3.6> 2019-01-02 03:26:37 Legolas systemd 1 - - Starting Discard unused blocks... ...
Laptop:
<3.6> 2018-12-30T22:58:51.181568+01:00 Isengard btrfsmaintenance-refresh-cron.sh 973 - - Refresh timer btrfs-trim for weekly <3.6> 2018-12-31T00:00:03.446660+01:00 Isengard systemd 1 - - Starting Discard unused blocks... <3.6> 2018-12-31T00:01:41.548922+01:00 Isengard fstrim 6391 - - /: 2.6 GiB (2778935296 bytes) trimmed <3.6> 2018-12-31T00:01:41.551418+01:00 Isengard systemd 1 - - Started Discard unused blocks. ...
I don't have entries on /etc/crypttab or fstab about discard or trim.
please show lslbk --discard on both systems.
Isengard:~ # lsblk --discard NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO sda 0 512B 2G 0 ├─sda1 0 512B 2G 0 ├─sda2 0 512B 2G 0 ├─sda3 0 512B 2G 0 ├─sda4 0 512B 2G 0 └─sda5 0 512B 2G 0 └─cr_home 0 0B 0B 0 sdb 0 0B 0B 0 └─sdb1 0 0B 0B 0 └─cr_hoard2 0 0B 0B 0 sdc 0 0B 0B 0 └─sdc1 0 0B 0B 0 └─cr_my_book 0 0B 0B 0 sdd 0 0B 0B 0 ├─sdd1 0 0B 0B 0 └─sdd2 0 0B 0B 0 └─cr_waterhoard 0 0B 0B 0 Isengard:~ # Legolas:~ # lsblk --discard NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO sda 0 512B 2G 0 ├─sda1 0 512B 2G 0 ├─sda2 0 512B 2G 0 ├─sda3 0 512B 2G 0 ├─sda4 0 512B 2G 0 ├─sda5 0 512B 2G 0 ├─sda6 0 512B 2G 0 ├─sda7 0 512B 2G 0 ├─sda8 0 512B 2G 0 │ └─cr_sda8 0 0B 0B 0 ├─sda9 0 512B 2G 0 ├─sda10 0 512B 2G 0 └─sda11 0 512B 2G 0 Legolas:~ #
Should I?
I guess it is up to you - whether you want to actually use TRIM or not.
I'm confused with discard vs trim. I understand that "discard" is simply the option word in fstab. I have trim periodically on the filesystem instead of online, I think I prefer it that way. And this thread made me think whether encrypted partitions should be handled differently. Do the periodic trim work on the encrypted filesystem? If it does, then I'm fine. Reading here: <https://wiki.debian.org/SSDOptimization> Says: «The "discard" options is not needed if your SSD has enough overprovisioning (spare space) or you leave (unpartitioned) free space on the SSD.» which is my case. -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)