It’s been a while since I’ve written anything but I ran into some problems after reinstalling my laptop with Fedora 20. I’ve been running Fedora for a while and I absolutely love it but I made a mess of my machine so it was time to start over. There’s not much to be said about the Fedora installation itself, I can’t really get used to anaconda but that’s a whole different story.
I’ve had some small problems getting theming to work in KDE apps like Dolphin and Kate, I usually do a Cinnamon install because it is very small and I like the interface a lot but at work I usually revert to i3wm which in my opinion is, by far, the best tiling window manager in existence. Even though this is not what this article is about, if you run into problems with themes in KDE apps, you can fix this by installing
qtconfig-qt4 and setting the gui style to GTK+.
Now, my boss requires me to encrypt my laptop’s ssd simply because there is a lot of work-related data on my laptop. Fedora doesn’t nag me multiple times for a passphrase if multiple luks devices use an identical one but Ubuntu had me typing it in four times at boot which was really annoying. A simple workaround to this problem is having a single encrypted partition with lvm inside it, you just make your luks device a physical volume for lvm and everything inside it is automatically encrypted. On the newer Ubuntu versions fstrim is automatically enabled and
issue_discards is automatically enabled in
/etc/lvm/lvm.conf, on Fedora you have to do this manually. I thought that was all but upon running
fstrim I was presented with an error message;
[root@noteloek ~]# fstrim -v / fstrim: /: discard operation not supported.
It turns out you also have to enable discards on your luks device in
/etc/crypttab. Here’s the whole process, step-by-step;
1. Allow discards on the luks device. Find your luks device in
/etc/crypttab and append
allow-discards to the lines that represent a luks device on an ssd. The second drive is the magnetic drive in my caddy, that’s why discards aren’t enabled for this one.
[root@noteloek ~]# cat /etc/crypttab luks-23326d8d-d697-4da7-aef0-66b832bbaaeb UUID=23326d8d-d697-4da7-aef0-66b832bbaaeb none allow-discards luks-b21d9e4f-602e-42fd-ba7a-2b0e51a80ce8 UUID=b21d9e4f-602e-42fd-ba7a-2b0e51a80ce8 none
Update your init ram drive using
[root@noteloek ~]# dracut -f
After a reboot you can check if it works by running
cryptsetup status, it should show the
[root@noteloek ~]# cryptsetup status luks-23326d8d-d697-4da7-aef0-66b832bbaaeb | grep flags flags: discards
2. Enable discards for lvm by setting
/etc/lvm/lvm.conf. You can do it by hand or use sed;
[root@noteloek ~]# sed -i 's|issue_discards\ =\ 0|issue_discards\ =\ 1|g' /etc/lvm/lvm.conf
3. Actually trim the device by either mounting with the
discard option or by running
fstrim, don’t do both… obviously. As far as I know the
fstrim solution is the preferred one as the
discard option supposedly has quite a negative impact on the performance of your ssd.
[root@noteloek ~]# cat /etc/fstab | grep root /dev/mapper/fedora-root / xfs defaults,discard,noatime,x-systemd.device-timeout=0 0 0
fstrim [mountpoint] lines to
/etc/cron.hourly/fstrim, you should modify this for the mount points on your system.
[root@noteloek ~]# echo -e "fstrim /\nfstrim /home\nfstrim /boot" > /etc/cron.hourly/fstrim
You can also manually run
fstrim -v /. The verbose option gives you the amount of data that was trimmed.
And that’s it!