Skip to content

Instantly share code, notes, and snippets.

@yuvadm
Last active October 12, 2020 11:21
Show Gist options
  • Select an option

  • Save yuvadm/52b3f350293a96501478 to your computer and use it in GitHub Desktop.

Select an option

Save yuvadm/52b3f350293a96501478 to your computer and use it in GitHub Desktop.

Revisions

  1. yuvadm revised this gist May 5, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ mkfs.ext4 /dev/mapper/vgroup-lvroot
    mkfs.ext4 /dev/mapper/vgroup-lvhome

    # Mount filesystems
    mnt /dev/mapper/vgroup-lvroot /mnt
    mount /dev/mapper/vgroup-lvroot /mnt
    mkdir -p /mnt/{boot,home}
    mount /dev/sda1 /mnt/boot
    mount /dev/mapper/vgroup-lvhome /mnt/home
  2. yuvadm revised this gist Dec 10, 2014. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -35,11 +35,18 @@ mount /dev/mapper/vgroup-lvhome /mnt/home
    # Install base system
    pacstrap -i /mnt base base-devel
    genfstab -U -p /mnt >> /mnt/etc/fstab
    # edit the fstab and add the `discards` option to all partitions
    # edit the fstab and add the `discard` option to all partitions

    # Chroot
    arch-chroot /mnt

    # Some general stuff
    echo computer_name > /etc/hostname
    ln -sf /usr/share/zoneinfo/zone/subzone /etc/localtime
    # uncomment locales in /etc/locale.gen
    locale-gen
    echo LANG=your_locale > /etc/locale.conf

    vi /etc/mkinitcpio.conf
    # add `ext4 dm_mod dm_crypt aes_x86_64 i915` modules
    # add the `encrypt` `lvm2` (before `filesystems`) and `shutdown` hooks
  3. yuvadm revised this gist Dec 10, 2014. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,13 @@ arch-chroot /mnt
    vi /etc/mkinitcpio.conf
    # add `ext4 dm_mod dm_crypt aes_x86_64 i915` modules
    # add the `encrypt` `lvm2` (before `filesystems`) and `shutdown` hooks
    mkinitcpio -p linux

    vi /etc/lvm/lvm.conf
    # set `issue_discards = 1`

    # Syslinux
    pacman -S syslinux gptfdisk
    syslinux-install_update -i -a -m
    vi /boot/syslinux/syslinux.cfg
    # use APPEND root=/dev/mapper/vgroup-lvroot cryptdevice=/dev/sda2:vgroup:allow-discards
  4. yuvadm created this gist Dec 10, 2014.
    48 changes: 48 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    # Arch Linux installation procedure on a Lenovo ThinkPad X200s
    # BIOS boot (no UEFI), SSD + LVM + LUKS + TRIM + discards

    # Randomize (or zero) drive contents
    dd if=/dev/urandom of=/dev/sda

    # Create GPT and partitions
    # Use gdisk to ensure proper partition alignment
    gdisk /dev/sda
    # 100MB boot partition on /dev/sda1 type 8300
    # Remaining root partition on /dev/sda2 type 8300

    # Setup encryption
    cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 \
    --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda2
    cryptsetup luksOpen /dev/sda2 cryptdisk

    # Create LVM partitions
    pvcreate /dev/mapper/cryptdisk
    vgcreate vgroup /dev/mapper/cryptdisk
    lvcreate --size 30G --name lvroot vgroup
    lvcreate --extents +100%FREE --name lvhome vgroup

    # Create filesystems
    mkfs.ext4 /dev/sda1
    mkfs.ext4 /dev/mapper/vgroup-lvroot
    mkfs.ext4 /dev/mapper/vgroup-lvhome

    # Mount filesystems
    mnt /dev/mapper/vgroup-lvroot /mnt
    mkdir -p /mnt/{boot,home}
    mount /dev/sda1 /mnt/boot
    mount /dev/mapper/vgroup-lvhome /mnt/home

    # Install base system
    pacstrap -i /mnt base base-devel
    genfstab -U -p /mnt >> /mnt/etc/fstab
    # edit the fstab and add the `discards` option to all partitions

    # Chroot
    arch-chroot /mnt

    vi /etc/mkinitcpio.conf
    # add `ext4 dm_mod dm_crypt aes_x86_64 i915` modules
    # add the `encrypt` `lvm2` (before `filesystems`) and `shutdown` hooks

    vi /etc/lvm/lvm.conf
    # set `issue_discards = 1`