Slackware on SSD/NVMe with full enryption (LUKS + LVM): Caveats, tips?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Slackware on SSD/NVMe with full enryption (LUKS + LVM): Caveats, tips?
Hi everyone,
believe it or not, up to now all my systems are running on 'classic' harddisks, up to today. However, I am planning an fresh install with an NVME disk (M2) on new hardware and a couple of upgrades from harddisk to SSD (SATA). All the hard disks in my systems are encrypted (LUKS + LVM), so I thought I would do the same with my SSD installs.
So I started to research the web on the topic. There is a lot of information available, and I have literally read tons and tons of it, but most of it seems to be outdated or is contradictory. The more I read the more I got confused, regarding aspects like wear-levelling, overprovisioning and TRIM. That's why I am asking for a little bit of advice from users with practical experience in installing Slackware on SSDs.
Here are some questions I am particularly interested in:
Overprovisioning
Does it make sense to leave some empty space in the partitioning scheme, additonal to what is built in anyway by the manufacturer? If so: how much?
While I found sources that highly recommend this, others say that it is totally unnecessary with 'modern' SSDs. Which is correct?
BTW, the oldest SSD I have here is from 2020, so they can all be considered reasonably 'modern', for that matter, I guess.
TRIM
How would I enable TRIM (discard) in /etc/mkinitrd? Is LUKSTRIM=yes sufficient? I am asking, because some of the sources I found say that TRIM must be enabled separately for LUKS and LVM, in order to make it work properly. LUKSTRIM seems to refer to LUKS only. What about LVM?
Swap partition?
Would you recommend to have a swap partition on an SSD, on a desktop PC or a laptop? I no: What about sleep mode and hibernation, where my laptop usually would save a RAM image on swap, and reload it into RAM on wake-up.
Offical documentation
Apart from arbitrary documentation I found on the internet, there is official documentation for Slackware, too. Unfortunately, it's either not very fresh or was written with only classic harddisks in mind.
Old, referring to Slackware 14.1: Installing Slackware 14.1 on a SSD drive
Written with mainly harddisks in mind, no mention of SSD or NVME: README_CRYPT.TXT
Are those instructions valid for installations on an SSD?
So, I'd appreciate if someone could provide some information of the current status, what's really necessary or recommended as well as possible caveats, when installing Slackware on an SSD.
I'm currently running LUKS + LVM on NVMe on my primary laptop.
The setup was done mostly following the "Combining LUKS and LVM" section of README_CRYPT.TXT.
One caveat is surely about the boot loader: lilo/elilo are not really up to the task, so i ended up creating an unenctypted, FAT32 partition for EFI boot (mounted at /boot/efi) and using Refind as the boot loader.
I use the folder /boot/efi/EFI/Slackware/ to save a copy of the kernel and initrd: vmlinux-generic, vmlinux-huge and initrd.gz
The bootloader itself is saved at /boot/efi/EFI/refind/refind_x64.efi, and refind.conf contains the following section for Slackware:
As you can see i added the "resume" kernel parameter needed for hibernation and a few others as well for my personal preference.
You may want to have a look at https://docs.slackware.com/howtos:sl...administration to see how you can set and edit EFI boot entries.
About your questions:
* i didn't take care of overprovisioning, since the NVMe drive is already meant to handle it by itself;
* TRIM: i read some documentation about all the steps required to enable TRIM on LUKS+LVM, but i gave up on trying.
* SWAP: depending on available RAM and you usage. I created an encrypted swap partition to be used for hibernation, since my laptop only supports "modern standby" and it kinda sucks (battery won't last 4 days in standby).
# cat /etc/cron.weekly/fstrim
#!/bin/sh
fstrim -v -a > /var/log/fstrim.log
Code:
# grep TRIM /etc/mkinitrd.conf
LUKSTRIM="/dev/nvme0n1p5" # verify support with 'hdparm -I $dev | grep TRIM'
See discard options in /etc/fstab above.
Unlike you I'm only using LUKS. I'm not using LVM. But when I was experimenting with it I had:
Code:
# grep discards /etc/lvm/lvm.conf
# Configuration option devices/issue_discards.
# Issue discards to PVs that are no longer used by an LV.
# used. Storage that supports discards advertise the protocol-specific
# way discards should be issued by the kernel (TRIM, UNMAP, or
# benefit from discards, but SSDs and thinly provisioned LUNs
# generally do. If enabled, discards will only be issued if both the
#issue_discards = 0
issue_discards = 1 <-- This is important
# Configuration option allocation/thin_pool_discards.
# The discards behaviour of thin pool volumes.
# thin_pool_discards = "passdown"
# causing problems. Features include: block_size, discards,
# discards_non_power_2, external_origin, metadata_resize,
# thin_disabled_features = [ "discards", "block_size" ]
Swap
My swap is on SSD. But due to having gobs of memory swap never gets used.
Official documentation
I used README_CRYPT.TXT and README_LVM.TXT as guides.
How so? I'm using LUKS for my root partition and use elilo. Of course /boot/efi is on vfat.
I'm sure it can be made to work, but every few months a new issue will pop up on new systems (eg. see last august's recent kernel boot failure with elilo).
I love lilo and use it on legacy systems because of its simplicity, but I kinda agree that's a dead horse to ride.
Code:
# grep TRIM /etc/mkinitrd.conf
LUKSTRIM="/dev/nvme0n1p5" # verify support with 'hdparm -I $dev | grep TRIM'
I'm not sure you can actually use hdparm on NVMe. It could work for old SATA SSDs.
I'm sure it can be made to work, but every few months a new issue will pop up on new systems (eg. see last august's recent kernel boot failure with elilo).
It Works For Me™. No issues.
Quote:
Originally Posted by ctrlaltca
Code:
# grep TRIM /etc/mkinitrd.conf
LUKSTRIM="/dev/nvme0n1p5" # verify support with 'hdparm -I $dev | grep TRIM'
I'm not sure you can actually use hdparm on NVMe. It could work for old SATA SSDs.
You are correct. The comment is there in the original file, which I didn't delete.
@ALL: Thanks a lot for sharing your experience!
To summarise, the general recommendation for Slackware on NVMEs (and, I guess, newer SATA SSDs, as well) seems to be:
Activate TRIM (allow discard)
Don't worry about wear levelling and don't leave space unused for the sake of overprovisioning, assuming that the manufacturer has taken care of this, already, appropriately
provided enough RAM, so that swap is rarely used, except for hibernating of a laptop, there is no need to worry about premature wear out of the SSD/NVME by swapping
"Newer" meaning produced after 2017 or so, right?
Let me know, if there is something to add or needs to be corrected in the above, admittedly very concise summary. Thanks in advance, again!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.