Personal record: Super complete Windows + Arch (lvm on luks) dual system installation
Installation Environment
- cpu: intel i5-10400
- Motherboard: MSI b460m mortar wifi
- Hard drive: sata 500gb ssd + western digital blue disk 1tb hdd
- Graphics card: intel uhd 630 integrated graphics
Target
- Windows
200gb is reserved for the c drive, and it is installed on the ssd. In addition, the hdd reserves 30g for the osu file.
- Arch
ssd: 500mb for /boot, 70gb for /root, 200gb for /home, encrypted with luks and thrown into lvm
hdd: The rest is made into a music/picture/video disk that the two systems can share
The reason why it is a personal record rather than a tutorial is because there are too many installation tutorials about arch on the Internet. I have not made much changes to the official website tutorial except adding encryption, lvm, and ntfs-3g. In addition, this record also includes some topics that are more suitable for post installation, such as adding users, installing graphical interfaces, and solving time confusion.
bios chapter 1
Advance usb in the boot priority, turn off fast boot and secure boot, and confirm whether the bios mode is uefi.
Windows articles
It is more convenient to install Windows first. After installation, enter the system and go to the disk manager to compress the c drive to 200gb, and then build a 30g simple volume for hdd.
Then go to the control panel and turn off hibernation and fast startup in the battery options.
arch chapter 1
After entering the arch, the first thing is networking. I am using wifi, so enter here
# iwctl
After entering iwctl, find the wifi device
[iwd]# device list
Scan for currently available networks
[iwd]# station wifi device name scan
enumerate networks
[iwd]# station wifi device name get-networks
After connecting, you will be asked for your password, enter it and enter.
[iwd]# station wifi device name connect wifi ssid
quit
[iwd]# exit
Ping to see if you have successfully connected to the Internet. If you get an error message of ping: name or service unknown, it may be that your dns server is not configured properly. "cat /etc/resolv.conf" to check.
# ping archlinux.org
Check if the clock is correct, if it is normal, nothing will be displayed
# timedatectl set-ntp true
Then we can happily syu
# pacman-Syu
Install a package that will be used shortly
# pacman -S ntfs-3g
Now I can start partitioning. First, I need to partition my ssd (if you don't know your device name, enter lsblk to see it first)
# fdisk /dev/sda
After entering fdisk, enter "n" to create a new partition; because I have windows, the default partition number is 5, and the default is enter; the first sector directly defaults to enter, and the last sector writes "+500m"; this is my boot partition.
Enter "n" to create a second partition; this time the number is 6, the default enter; both the first sector and the last sector can default to enter; this is my lvm partition. Then enter "t" to change the partition attributes, enter "l" to list all attributes, and finally we can enter the number in front of Linux LVM to change it to lvm.
After confirming that it is correct, enter "w" to save and exit. There is no need for the efi partition here because we can directly use the windows one.
Then partition the hdd
# fdisk /dev/sdb
Enter "n" to create a new partition, then all default, "w" to save and exit.
Now I'm going to start encrypting my lvm partition, because the number allocated to the lvm partition just now is 6, enter here
# cryptsetup luksFormat /dev/sda6
After entering the above command, luks will ask you for a password, and open the decrypted container after success. cryptlvm is my name for the container
# cryptsetup open /dev/sda1 cryptlvm
If you are worried, you can check again whether the encryption is successful.
# ls /dev/mapper
After encryption, you can stack lvm on it, first create a physical volume
# pvcreate /dev/mapper/cryptlvm
Create volume groups. vg0 is the name I gave the volume group
# vgcreate vg0 /dev/mapper/cryptlvm
Create a logical volume, here is 70g for root
# lvcreate -L 70G vg0 -n root
Then give the rest to home
# lvcreate -l 100%FREE vg0 -n home
After the partition is created, we need to format the partition. First format my boot partition as ext4
# mkfs.ext4 /dev/sda5
then my root
# mkfs.ext4 /dev/vg0/root
and my home
# mkfs.ext4 /dev/vg0/home
Finally don't forget my hdd partition. In order for windows to be able to read and write the contents of this partition smoothly, we need to format it as ntfs. data_shared is my disk label.
# mkfs.ntfs -Q -L data_shared /dev/sdb3
After formatting, you need to mount them one by one. Be sure to mount root first, otherwise fstab will have errors
# mount /dev/vg0/root /mnt
Create boot folder
# mkdir /mnt/boot
mount boot
# mount /dev/sda5 /mnt/boot
Create home folder
# mkdir /mnt/home
mount home
# mount /dev/vg0/home /mnt/home
Create a shared file folder
# mkdir /data_shared
mount my ntfs partition
# ntfs-3g /dev/sdb3 /data_shared
After mounting, you need to write all your partition information into fstab
# genfstab -U /mnt >> /mnt/etc/fstab
"cat /etc/fstab" to check if all partitions are detected. It seems that ntfs cannot be detected, so I have to wait until the user is added and then manually join.
Then you can start the installation. I didn't change the mirror source because the default is fast enough for me
# pacstrap /mnt base base-devel linux linux-firmware linux-headers
chroot in
# arch-chroot /mnt
Packages that may be needed after continuing to download
# pacman -S openssh networkmanager wpa_supplicant wireless_tools netctl nano lvm2 dialog git
Allow networkmanager to start automatically at boot, so that you don't have to reconnect to wifi every time. Remember to pay attention to capitalization
# systemctl enable NetworkManager
To set the time, first find your time zone
# timedatectl list-timezones
Set the time zone, I chose New York
# timedatectl set-timezone America/New_York
Synchronized hardware clock
# hwclock --systohc
set locale
# nano /etc/locale.gen
Remove the # in the following line, and add other if necessary
en_US.UTF-8 UTF-8
generate locale
# locale-gen
Create and modify locale.conf
# nano /etc/locale.conf
Write the following, do not write the others
LANG=en_US.UTF-8
Create and modify the hostname, after entering, give your arch a name, I wrote myarch
# nano /etc/hostname
Modify hosts
# nano /etc/hosts
Add the following lines
127.0.0.1 localhost ::1 localhost 127.0.1.1 myarch.localdomain myarch
We need to change some system files to make lvm and luks work properly, first modify mkinitcpio.conf
# nano /etc/mkinitcpio.conf
Find a line of hooks without "#", then add "encrypt" and "lvm2" between block and filesystems
HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)
Enter the following to recreate the initramfs
# mkinitcpio -P
Create a password for the root user
#passwd
Add a non-root user, I created a user called rein
# useradd -m -G wheel rein
Create a password for this user
# passwd rein
authorize this user
# EDITOR=nano visudo
Find the line where "uncomment to allow members of group wheel to execute any command" is written, and remove the # in that line, so that ordinary users can run sudo
% wheel ALL = (ALL) ALL
You can start to download and configure grub. From this step, please be very vigilant, otherwise it will be very painful to cultivate
# pacman -S grub efibootmgr os-prober dosfstools mtools
Modify the grub file to make luks work properly
# nano /etc/default/grub
Find the following line and add this line between loglevel=3 and quiet. /dev/sda6 is my encrypted device and vg0 is my volume group name
GRUB_CMDLINE_LINUX_DEFAULT = "loglevel=3 cryptdevice=/dev/sda6:vg0:allow-discards quiet"
Create efi folder
# mkdir /boot/efi
Mount the efi partition created by windows. my efi is at /dev/sda1
# mount /dev/sda1 /boot/efi
install grub
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub
Generate grub.cfg, at this time you can close your eyes and pray that grub can successfully find the windows boot manager
# grub-mkconfig -o /boot/grub/grub.cfg
Exit the chroot environment
# exit
unmount
# umount -a
Reboot and pray. After I restarted, the windows interface popped up, because my windows boot manager in the bios was ahead of time, and maybe because I forgot to turn off secure boot. Don't worry, enter the windows shutdown and then enter the bios to modify
# reboot
bios chapter 2
Confirm that secure boot is turned off, and then advance the arch_grub in the startup item
arch chapter 2
After exiting the bios, you should be able to see the grub menu. If you want to enter windows, you must be quick, otherwise you will automatically jump to arch. Here we advance arch.
If the configuration is correct, luks will ask you for a password. If the password is correct, you can successfully enter the system. The screen will show myarch (this is your hostname) login, enter your username and then your password to get in. Here for the convenience of root operation.
Advanced nmtui setup wifi
#nmtui
After success, ping to see if it is connected, and then we need to modify the fstab that has not been changed just now. Before changing, you need to know my id, rein is my username
# id rein
Modify fstab
# nano /etc/fstab
Write the following on the last line. /dev/sdb3 is my ntfs partition, /data_shared is my mount point, uid and gid are the results of the command just now
/dev/sdb3 /data_shared ntfs-3g uid=userid,gid=groupid,dmask=022,fmask=133,big_writes,windows_names 0 0
Save and exit, now install mesa. No need for xf86-video-intel here
# pacman -S mesa
Install the graphical interface. I personally prefer kde, so install the following packages. Unless you want your computer to be full of software that you will never use in your life, you don't need kde-applications, and then install all the software yourself
# pacman -S xorg sddm plasma-meta packagekit-qt5
Allow sddm to start automatically, so that you can see the login interface without manually allowing it every time you enter tty
# systemctl enable sddm
reboot, pray
# reboot
I later reduced the size of the shared file partition in windows, and then built an ext4 partition in arch for backup. After two or three weeks of arch, it feels okay, at least for the time being. Images, wifi, bluetooth, etc. can be used normally.
So far, I wish everyone can embrace their arch
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!