Skip to content

Instantly share code, notes, and snippets.

@kernelcoffee
Last active June 12, 2018 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kernelcoffee/537ee095301332cc49716157afd68b19 to your computer and use it in GitHub Desktop.
Save kernelcoffee/537ee095301332cc49716157afd68b19 to your computer and use it in GitHub Desktop.
ArchLinux dual-boot Win10 LVM/Luks
## Reinstall windows
- get windows install
https://www.microsoft.com/en-us/software-download/windows10ISO
- custom install on setup
- during partition setup -> fix 100MB only efi partition
Press Shift+F10 to open Command Line.
Type `diskpart` Enter. Diskpart will take a while to launch.
Type `list disk` Enter A list of disks will be printed. Note the number next to yours (most likely 0). Select that disk: select disk 0 Enter.
Create ESP: `create partition efi size=500` Enter (500 is partition size in MiB).
Exit Diskpart: `exit` Enter.
source: https://superuser.com/questions/1308324/create-efi-partition-before-installing-windows-10
- Finish windows install
## Arch install
- Boot from usb key
## init wifi network
`wifi-menu`
## update package index
`pacman -Syyy`
## List Partitions
```
fdisk -l
fsblk
```
## Create partitions
```
# Enter disk
fdisk /dev/nvme0n1
## list partition
p
Device Start End Sectors Size Type
/dev/nvme0m1p1 2048 1026047 1024000 500M EFI System
/dev/nvme0m1p2 1026048 1058815 32768 16M Microsoft Reserved
/dev/nvme0n1p3 1058816 730648575 729589760 347.9G Microsoft basic data
## create boot partition
* n
* enter (last entry)
* enter (first sector)
* +1G (500M works as well)
## create lvm partition
* n
* enter (last entry)
* enter (first sector)
* enter (last sector)
* t (type)
* 32 (lvm)
## preview
* p
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1026047 1024000 500M EFI System
/dev/nvme0n1p2 1026048 1058815 32768 16M Microsoft Reserved
/dev/nvme0n1p3 1058816 730648575 729589760 347.9G Microsoft basic data
/dev/nvme0n1p4 730648577 732745727 2097152 1G Linux filesystem
/dev/nvme0n1p5 732745728 2000409230 1267663503 604.5G Linux LVM
## Write partitions
* w
```
## Format boot partition
`mkfs.ext4 /dev/nvme0n1p4`
## Setup encryption
`cryptsetup luksFormat /dev/nvme0n1p5`
* YES
`cryptsetup open --type luks /dev/nvme0n1p5 lvm`
## Setup LVM
`pvcreate /dev/mapper/lvm`
`vgcreate volgroup0 /dev/mapper/lvm`
`lvcreate -L 50G volgroup0 -n lv_root`
`lvcreate -L 16G volgroup0 -n lv_swap`
`lvcreate -l 100%FREE volgroup0 -n lv_home`
`modprobe dm_mod`
`vgscan`
`vgchange -ay`
`mkfs.ext4 /dev/volgroup0/lv_root`
`mkfs.ext4 /dev/volgroup0/lv_home`
`mkswap /dev/volgroup0/lv_swap`
`swapon /dev/volgroup0/lv_swap`
`mount /dev/volgroup0/lv_root /mnt` # mount root partition
`mkdir /mnt/boot` # populate root partititon
`mkdir /mnt/home`
`mount /dev/nvme0n1p4 /mnt/boot` # mount boot partition into /boot
`mkdir -p /mnt/boot/efi`
`mount /dev/nvme0n1p1 /mnt/boot/efi` # mount efi partition into /boot/efi
`mount /dev/volgroup0 /mnt/home` # mount home parition
## Install Arch
`pacstrap -i /mnt base base-devel`
## generate fstab
`gensfstab -U /mnt >> /mnt/etc/fstab`
## change chroot
`arch-chroot /mnt`
`pacman -S vim grub efibootmgr dosfstools os-prober mtools linux-headers`
## Setup locale
`vim /etc/locale.gen`
uncomment en_US.UTF-8 UTF-8 or the locale you use
`locale-gen`
## Setup time
TODO
## Setup initramfs hooks
#Add encrypt and lvm2 hook to /etc/mkinitcpio.conf:
`vim /etc/mkinitcpio.conf`
HOOKS="...encrypt lvm2 filesystems..."
#Re-generate the initramfs image:
`mkinitcpio -p linux`
## Update grub CMD_LINE
GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=/dev/nvme0n1p5:volgroup0 quiet"
## Update grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
## Reboot
exit
umount -R /mnt
reboot
http://tech.memoryimprintstudio.com/dual-boot-installation-of-arch-linux-with-preinstalled-windows-10-with-encryption/
https://gilyes.com/Installing-Arch-Linux-with-LVM/
https://www.youtube.com/watch?v=ZS0H3vQUtRw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment