Slackware-Guides-LUKS LVM

From LQWiki
Jump to navigation Jump to search


How do I install Slackware with LVM-partitions?

Here's a small info for installing slack with lvm-partitions. This was tested using the new 11.0 CD's. I haven't tried to include root partition on lvm-partition as it requeires a special initrd / initramfs image that will enable lvm before the root can be mounted.

  1. Boot test26.s
  2. Make the partitions you want. Make at least one partition of type 8e (LVM). For example, create / (1gb), /boot (100mb), and a suitable size swap partition.
  3. Make a temporary ram-disk and copy a few folders to it to ease the installation:
    1. mkdir /ram
    2. mount -t tmpfs none /ram
    3. mv /sbin /ram
    4. mv /lib/modules /ram
    5. mv /usr /ram
    6. mv /bin /ram
    7. /ram/bin/ln -s /ram/bin /
    8. /ram/bin/ln -s /ram/sbin /
    9. /ram/bin/ln -s /ram/usr /
    10. /ram/bin/ln -s /ram/modules /lib
  4. Mount the slackware 11.0 CD 2
    1. mount /dev/hdc /cdrom
  5. Install device-mapper and lvm2 packages
    1. installpkg /cdrom/extra/lvm2/*.tgz
  6. Make the partitions
    1. vgscan
    2. pvcreate /dev/sda4
    3. vgcreate /dev/sda4 vg
    4. lvcreate -L2G -nusr vg etc...
  7. Start setup process. After mounting the other partitions when the installer shows the details of mounted partitions, switch to another console. You *must* have at least mounted the new root to /mnt before you do the next steps
  8. make filesystems on the lvm-partitions and mount the under /mnt
    1. mkreiserfs /dev/vg/usr
    2. mkdir /mnt/usr
    3. mount /dev/vg/usr /mnt/usr
  9. Remove the Slackware 11.0 CD 2
    1. umount /cdrom
    2. remove CD 2 and reinsert CD 1
  10. Switch back to setup and complete it
  11. After installation don't reboot as we have still work to do :)
  12. Chroot to new installation
    1. chroot /mnt && source /etc/profile
  13. Edit fstab to include the lvm-partitions
  14. Install lvm2 and device-manager packages again.
  15. run 'vgscan' command
  16. All done, you can now umount filesystems and reboot to your new slackware installation

There's the quick guide to get slack working with lvm-partitions. It's pretty rough so it might contain some errors in it.

How do I install Slackware on a encrypted root partition?

Here's a small info for installing slack to encrypted partition: Written for 10.2 but should work for 11.0 with minor editions. I don't deal all the issues in here as most of this was done as pointed in Gentoo how-to ponted out. Can be found in gentoo-wiki from System_Encryption_DM-Crypt_with_LUKS

  1. Boot test26.s
  2. Make 3 partitions, /boot, 'small' root and format rest but don't mount it
  3. Start installation and install a minimal Slack to the root.
  4. Chroot to new system and install kernel-headers, kernel-modules etc.
  5. Compile new kernel to add support for ciphers, initramfs and dm-mod.
  6. Boot into the new system
  7. Download the staticly compiled 'cryptsetup' from their site
  8. Encrypt and prepare the largest partition which was left empty during initial install
    1. cryptsetup -c aes-cbc-essiv:sha256 -y -s256 luksFormat /dev/sda3
    2. cryptsetup luksOpen /dev/sda3 root
    3. mkreiserfs /dev/mapper/root
  9. Goto single user mode 'telinit 1'
  10. Mount the encrypted root 'mount /dev/mapper/root/ /mnt/hd'
  11. Copy old root to new encrypted root
    1. "cp -av /usr /mnt/hd/" and loop for other dir's too.
  12. chroot to new root and fix fstab
  13. Make initramfs and compile it into kernel ( Check gentoo site, init works in slack)
  14. Wipe the previous root and format it as swap
  15. Edit rc.S so the swap will be encrypted at every boot
    1. cryptsetup -c blowfish -s 64 -d /dev/urandom create swap0 /dev/hda2
    2. mkswap /dev/mapper/swap0
    3. swapon /dev/mapper/swap0

Put the above just before "swapon -a" command

  1. Boot into new encrypted system.


There's the quick guide to get encrypted slack. It's pretty rough so you need to know what you're doing before trying it.