The goal is to set up a new Arch Linux and Windows (just for some games) on my new PC and use dual-boot using GRUB.
Disks
Currently, disks layout is next:
[root@archiso ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 476.7M 1 loop /run/archiso/sfs/airootfs
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 931.5G 0 disk
sdc 8:32 1 28.9G 0 disk
├─sdc1 8:33 1 588M 0 part /run/archiso/bootmnt
└─sdc2 8:34 1 64M 0 part
-
/dev/sda
– SSD, will be for Windows -
/dev/sdb
– HDD, for Arch Linux
On /dev/sdb
have to create the next partitions:
-
sdb1
– EFI, 512M -
sdb2
– boot, 1G -
sdb3
– swap, 32G -
sda4
– LVM, all
fdisk
Run fdisk
, and create new partitions table:
[root@archiso ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.33).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA DT01ACA1
Units: sectors of 1 \* 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x73c946df
...
Create new for EFI, 512М:
...
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-1953525167, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1953525167, default 1953525167): +512M
Created a new partition 1 of type 'Linux' and of size 512 MiB.
...
Set its type to EFI:
...
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): L
...
10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/
...
Hex code (type L to list all codes): ef
Changed type of partition 'Linux' to 'EFI (FAT-12/16/32)'.
...
The next partition – for /boot
, 1G:
...
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (1050624-1953525167, default 1050624):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-1953525167, default 1953525167): +1G
Created a new partition 2 of type 'Linux' and of size 1 GiB.
...
And next – for swap, 32G:
...
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (3,4, default 3):
First sector (3147776-1953525167, default 3147776):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (3147776-1953525167, default 1953525167): +32G
Created a new partition 3 of type 'Linux' and of size 32 GiB.
...
Set its type to swap:
...
Command (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.
...
The last one is for LVM (take a note: fdisk
will suggest Extended type – I used Primary here):
...
Command (m for help): n
Partition type
p primary (3 primary, 0 extended, 1 free)
e extended (container for logical partitions)
Select (default e): p
Selected partition 4
First sector (70256640-1953525167, default 70256640):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (70256640-1953525167, default 1953525167):
Created a new partition 4 of type 'Linux' and of size 898 GiB.
...
Check the partitions layout now:
...
Command (m for help): p
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA DT01ACA1
Units: sectors of 1 \* 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x73c946df
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1050623 1048576 512M ef EFI (FAT-12/16/32)
/dev/sdb2 1050624 3147775 2097152 1G 83 Linux
/dev/sdb3 3147776 70256639 67108864 32G 82 Linux swap / Solaris
/dev/sdb4 70256640 1953525167 1883268528 898G 83 Linux
...
Write new partitions table:
...
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
LVM
Create Physical Volume:
[root@archiso ~]# pvcreate /dev/sdb4
Physical volume "/dev/sdb4" successfully created.
Create Volume Group:
[root@archiso ~]# vgcreate vg_arch /dev/sdb4
Volume group "vg_arch" successfully created
Logical Volume with the root name:
[root@archiso ~]# lvcreate -L 100G -n root vg_arch
Logical volume "root" created.
Logical Volume with the home name:
[root@archiso ~]# lvcreate -l 100%FREE -n home vg_arch
Logical volume "home" created.
Filesystems creation
For the EFI – fat32
:
[root@archiso ~]# mkfs.fat -F32 /dev/sdb1
mkfs.fat 4.1 (2017-01-24)
ext2
– for /boot
:
[root@archiso ~]# mkfs.ext2 /dev/sdb2
ext4
for root
:
[root@archiso ~]# mkfs.ext4 /dev/vg_arch/root
ext4
for /home
[root@archiso ~]# mkfs.ext4 /dev/vg_arch/home
Create swap:
[root@archiso ~]# mkswap /dev/sdb3
Setting up swapspace version 1, size = 32 GiB (34359734272 bytes)
no label, UUID=14e18ccc-11f4-4e2b-baf2-c141735b8800
Turn it on:
[root@archiso ~]# swapon /dev/sdb3
Mount root into the /mnt
directory:
[root@archiso ~]# mount /dev/vg_arch/root /mnt/
/home
:
[root@archiso ~]# mkdir /mnt/home
[root@archiso ~]# mount /dev/vg_arch/home /mnt/home/
/boot
:
[root@archiso ~]# mount /dev/sdb2 /mnt/boot/
EFI:
[root@archiso ~]# mkdir /mnt/boot/EFI
[root@archiso ~]# mount /dev/sdb1 /mnt/boot/EFI
Arch Linux install
Install OS, sshd
и vim
and whatever you want right now:
[root@archiso ~]# pacstrap -i /mnt base base-devel openssh vim
Generate /etc/fstab
:
[root@archiso ~]# genfstab -pU /mnt >> /mnt/etc/fstab
Chroot to the new system:
[root@archiso ~]# arch-chroot /mnt /bin/bash
Edit the /etc/mkinitcpio.conf
, add the lvm
hook:
HOOKS=(base udev autodetect keyboard keymap modconf block lvm2 filesystems fsck)
Build the kernel:
[root@archiso /]# cd /boot/ && mkinitcpio -p linux
GRUB
Install GRUB and other needed packages:
[root@archiso boot]# pacman -S grub efibootmgr dosfstools os-prober mtools
Install bootloader with the EFI type and ArchLinux name:
[root@archiso boot]# grub-install --target=x86_64-efi --bootloader-id=ArchLinux --recheck
Installing for x86_64-efi platform.
GUID Partition Table Header signature is wrong: 0 != 5452415020494645
GUID Partition Table Header signature is wrong: 0 != 5452415020494645
GUID Partition Table Header signature is wrong: 0 != 5452415020494645
GUID Partition Table Header signature is wrong: 0 != 5452415020494645
GUID Partition Table Header signature is wrong: 0 != 5452415020494645
GUID Partition Table Header signature is wrong: 0 != 5452415020494645
Installation finished. No error reported.
Create GRUB’s config file:
[root@archiso boot]# grub-mkconfig -o /boot/grub/grub.cfg
Check this post if it hangs –Arch Linux: grub-mkconfig hangs on the /boot/grub/grub.cfg config generation.
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done
And we are done Arch for now.
Windows dual boot
For the obvious reasons – Windows installation process is out of the scope of this blog :-)
Install it on the /dev/sda
device and check partitions now:
[root@archlinux /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
|-sda1 8:1 0 499M 0 part
|-sda2 8:2 0 100M 0 part
|-sda3 8:3 0 16M 0 part
`-sda4 8:4 0 223G 0 part
sdb 8:16 0 931.5G 0 disk
|-sdb1 8:17 0 512M 0 part /boot/EFI
|-sdb2 8:18 0 1G 0 part /boot
|-sdb3 8:19 0 32G 0 part [SWAP]
`-sdb4 8:20 0 898G 0 part
|-vg_arch-root 254:0 0 100G 0 lvm /
`-vg_arch-home 254:1 0 798G 0 lvm /home
sdc 8:32 1 28.9G 0 disk
|-sdc1 8:33 1 588M 0 part
`-sdc2 8:34 1 64M 0 part
Windows-boot can be seen in the UEFI BIOS on the device 1 (/dev/sda
):
Аnd Arch – on the deivce 2 (/dev/sdb
).
If os-prober
not installed yet – install it:
[root@archlinux /]# pacman -S os-prober
Check the /dev/sda
partitions:
[root@archlinux /]# fdisk -l /dev/sda
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Disk model: KINGSTON SA400S3
Units: sectors of 1 \* 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 78241A73-6994-4D0B-9FCB-433076B5EC41
Device Start End Sectors Size Type
/dev/sda1 2048 1023999 1021952 499M Windows recovery environment
/dev/sda2 1024000 1228799 204800 100M EFI System
/dev/sda3 1228800 1261567 32768 16M Microsoft reserved
/dev/sda4 1261568 468860927 467599360 223G Microsoft basic data
To make os-prober
available to find Windows, which is installed on another device – we need to mount its boot-partition which is 204800 100M EFI System. for Windows.
Mount it:
[root@archlinux /]# mount /dev/sda2 /mnt/
[root@archlinux /]# ls -l /mnt/
total 1
drwxr-xr-x 4 root root 1024 Feb 24 10:24 EFI
Run os-prober
:
[root@archlinux /]# os-prober
/dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
Backup existing GRUB’s config:
[root@archlinux /]# cp /boot/grub/grub.cfg /boot/grub/grub.cfg-origin
Re-generate it:
[root@archlinux /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Found Windows Boot Manager on /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi
done
Reboot PC:
And we are done.
Similar posts about Arch install (in Russian)
- Arch: установка поверх Ubuntu с сохранением home в LVM
- Arch Linux: установка с UEFI, GPT, LVM и LUKS шифрованием
- Arch Linux: установка с LVM и LUKS шифрованием диска
- Arch: послеустановочные настройки
Similar posts
- 02/24/2019 Arch Linux: установка с EFI и dual-boot с Windows (0)
- 04/09/2017 Arch: примонтировать NTFS (0)
- 03/12/2017 Linux: LVM – разделить /root и добавить /home (0)
- 03/09/2017 Arch: установка поверх Ubuntu с сохранением home в LVM (0)
- 03/29/2017 Arch: Skype – звук и микрофон (0)
Top comments (0)