TRIM on a cheap NVMe SSD
I used to be a die-hard, very happy Mac user. I’ve been using Mac OS in one form or another continuously since the late ’80s. And ever since the early 2000s, my favorite laptop hardware has been Apple’s. Coupled with a decent UNIX environment and the ability to develop for iOS devices, I was pretty attached. Unfortunately, I do enough work in virtual machines that 16GB of system RAM has been feeling tight for a few years. When my late 2011 17" MBP bit the dust due to a GPU issue, I tried to stretch it out with a 13" model for a while. When that became problematic, and Apple had not only failed to introduce a laptop that could take more than 16GB of RAM but also done silly things like eliminate the esc
key from their laptop keyboards, I couldn’t stick it out any longer. I picked up a ThinkPad 480 with 32GB RAM and used the M.2 2242 slot that Lenovo intended for a WWAN card to install an extra 256GB SSD. The Toshiba RC100 is not high end, but it has served well as a boot drive, leaving the faster Samsung drive for VM and build storage.
With the release of Fedora 31, I decided that I wanted to “nuke and pave” the OS drive, mostly because some of my experiments with Smart Card support had gotten some of the login plumbing into a state that I couldn’t easily set right, and it was messing with yubikey support, printer support, and login times. Sometimes it’s just easier to reinstall.
I chose to install the KDE plasma spin of F31, and for the most part everything has been as expected. The main wart has been that the boot drive has been ridiculously slow ever since the fresh install.
When I finally had to use the power switch after over 10 minutes of “shutting down” I decided to dig in and troubleshoot. The timing of the sluggishness made it feel like the drive was too full, even with ample free space. After booting off a live thumb drive and fiddling around, here’s how I got things cleaned up:
cryptsetup luksOpen --allow-discards /dev/nvme0n1p3 rootDevice
mkdir /sysmount
mount /dev/mapper/fedora_clamps-root /sysmount
mount /dev/mapper/fedora_clamps-home /sysmount/home
fstrim /sysmount
fstrim /sysmount/home