Arch Linux install to RAID1 storage (BIOS boot)

Install Arch Linux under the following conditions.

conditions

Creating and booting USB installation media

Download the ISO file ʻarchlinux-year.month.day-x86_64.iso` from the official Download ArchLinux page.

Write the ISO file to the USB memory using the dd command.

# dd bs=4M if=/path/to/archlinux.iso of=/dev/sdy status=progress && sync

When the USB installation media is complete, boot the live environment from the USB installation media.

Arch Linux installation

Create partition for / dev / sda

root@archiso ~ # gdisk /dev/sda
###Version information etc.###

Comand (? for help):o
This option deletes all partitions and create a new protective MBR.
Proceed? (Y/N):Y
Comand (? for help):n
Partition number (1-128, default 1):1
First sector (34-xxxxxx, default = 2048) or {+-}size{KMGTP}:2048
Last sector (2048-xxxxxx, default = xxxxxx) or {+-}size{KMGTP}:+100MB
Hex code or GUID (L to show codes, Enter = 8300):ef02
Changed type of partition to 'BIOS boot partition'

Comand (? for help):n
Partition number (1-128, default 2):2
First sector (34-xxxxxx, default = 206848) or {+-}size{KMGTP}:206848
Last sector (2048-xxxxxx, default = xxxxxx) or {+-}size{KMGTP}:-100MB
Hex code or GUID (L to show codes, Enter = 8300):fd00
Changed type of partition to 'Linux RAID'

Comand (? for help):w

Final checks compleate. About to write GPT data. THIS WILL OVERWRITE EXISTING 
PARTITIONS!!

DO you want to proceed? (Y/N):Y
OK; writing new GUID partition table (GPT) to /dev/sda
The Operation has compleated successfully.

Create partition for / dev / sdb (same setting as / dev / sda)

root@archiso ~ # gdisk /dev/sdb
###Version information etc.###

Comand (? for help):o
This option deletes all partitions and create a new protective MBR.
Proceed? (Y/N):Y
Comand (? for help):n
Partition number (1-128, default 1):1
First sector (34-xxxxxx, default = 2048) or {+-}size{KMGTP}:2048
Last sector (2048-xxxxxx, default = xxxxxx) or {+-}size{KMGTP}:+100MB
Hex code or GUID (L to show codes, Enter = 8300):ef02
Changed type of partition to 'BIOS boot partition'

Comand (? for help):n
Partition number (1-128, default 2):2
First sector (34-xxxxxx, default = 206848) or {+-}size{KMGTP}:206848
Last sector (2048-xxxxxx, default = xxxxxx) or {+-}size{KMGTP}:-100MB
Hex code or GUID (L to show codes, Enter = 8300):fd00
Changed type of partition to 'Linux RAID'

Comand (? for help):w

Final checks compleate. About to write GPT data. THIS WILL OVERWRITE EXISTING 
PARTITIONS!!

DO you want to proceed? (Y/N):Y
OK; writing new GUID partition table (GPT) to /dev/sdb
The Operation has compleated successfully.

Creating a RAID1 array (/ dev / md0)

root@archiso ~ # mdadm --create --verbose --level=1 --metadata=1.2 --chunk=64 --raid-devices=2 /dev/md0 /dev/sda1 /dev/sdb1
mdadm: chunk size ignored for this level
mdadm: /dev/sda1 appers to contain an ext2fs file system
       size=101376K mtime=xxx xxx  x xx:xx:xx xxxx
mdadm: /dev/sdb1 appers to contain an ext2fs file system
       size=101376K mtime=xxx xxx  x xx:xx:xx xxxx
mdadm: size set to 101376K
Continue creating array?y
mdadm: array /dev/md0 started

Creating a RAID1 array (/ dev / md1)

root@archiso ~ # mdadm --create --verbose --level=1 --metadata=1.2 --chunk=64 --raid-devices=2 /dev/md1 /dev/sda2 /dev/sdb2
mdadm: chunk size ignored for this level
mdadm: size set to xxxxxxxxxK
mdadm: automatically enabling write-intent bitmap on large array
mdadm: array /dev/md1 started

Display the creation status of the RAID array

root@archiso ~ # cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[0]
      xxxxxxxxx blocks super 1.2 [2/2] [UU]
      [==>..................] resync = 38.9% (yyyyyyy/xxxxxxxxx) finish=7.6min speed 153642K/sec
      bitmap: 1/1 pages [4KB], 65536KB chunk

md0 : active raid1 sdb1[1] sda1[0]
      101376 blocks super 1.2 [2/2] [UU]

unused devices: <none>

Wait until the RAID array is created. It may take more than an hour to run on a large capacity HDD.

Initialize the partition when the array creation is complete.

root@archiso ~ # mkfs.ext4 /dev/md0 
root@archiso ~ # mkfs.ext4 /dev/md1

Mount the created partition.

root@archiso ~ # mount /dev/md1 /mnt
root@archiso ~ # mkdir /mnt/boot
root@archiso ~ # mount /dev/md0 /mnt/boot

Time setting

root@archiso ~ # timedatectl set-ntp true
root@archiso ~ # timedatectl set-timezone Asia/Tokyo

Select a mirror list to install the ArchLinux package (select a Japanese server)

root@archiso ~ # vim /etc/pacman.d/mirrorlist
root@archiso ~ # cat /etc/pacman.d/mirrorlist
##
## Arch Linux repository mirrorlist
## Filtered by mirror score from mirror status page
## Generated on 20xx-xx-xx
##

## Japan
Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
## Japan
Server = http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/$repo/os/$arch
## Japan
Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch
## other country
...

Installation of base system and required packages

root@archiso ~ # pacstrap /mnt base linux linux-firmware vim dhcpcd mdadm

Update the mdadm configuration file. If you do not do this, the md127 problem will occur.

root@archiso ~ # mdadm --detail --scan >> /mnt/etc/mdadm.conf
root@archiso ~ # cat /mnt/etc/mdadm.conf
...
...
...
ARRAY /dev/md0 metadata=1.2 name:archiso:0 UUID=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy 
ARRAY /dev/md1 metadata=1.2 name:archiso:0 UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Create an fstab to determine the disk using the UUID.

root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab
root@archiso ~ # cat /mnt/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/md1
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx       /               ext4            rw,relatime     0 1

# /dev/md0
UUID=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy       /boot           ext4            rw,relatime     0 2

Chroot to the installed environment

root@archiso ~ # arch-chroot /mnt

Time zone and time settings

[root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Tokyo > /etc/localtime
[root@archiso /]# hwclock --systohc

Setting the character code to use

[root@archiso /]# vim /etc/locale.gen
[root@archiso /]# cat /etc/locale.gen
en_US.UTF-8 UTF-8
ja_JP.UTF-8 UTF-8
[root@archiso /]# locale-gen
[root@archiso /]# vim /etc/locale.conf
[root@archiso /]# cat /etc/locale.conf
LANG=en_US.UTF-8

Hostname settings

[root@archiso /]# vim /etc/hostname
[root@archiso /]# cat /etc/hostname
myhostname

Network settings

[root@archiso /]# vim /etc/hosts
[root@archiso /]# cat /etc/hosts
127.0.0.1 localhost
::1    localhost
127.0.1.1 myhostname.localdomain	myhostname

root password setting

[root@archiso /]# passwd

Added mdadm hook to mkinitcpio.conf

[root@archiso /]# vim /etc/mkinitcpio.conf
[root@archiso /]# cat /etc/mkinitcpio.conf
....
MODULES=(raid1 ext4)
....
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck mdadm_udev)
....

Create an initramfs image

[root@archiso /]# mkinitcpio -p linux

Install and configure the bootloader. For RAID1, execute the grub-install command in / dev / sda and / dev / sdb respectively.

[root@archiso /]# pacman -S grub os-prober intel-ucode
[root@archiso /]# grub-install --target=i386-pc --debug /dev/sda
[root@archiso /]# grub-install --target=i386-pc --debug /dev/sdb
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg

Set to connect to the network at boot time

[root@archiso /]# systemctl enable dhcpcd

Log out of chroot and reboot

[root@archiso /]# exit
root@archiso ~ # umount -R /mnt
root@archiso ~ # reboot

Initial settings after installing Arch Linux

Log in as root

myhostname login : root
passwd

Create a local user

[root@myhostname ~]# useradd -m -G wheel -s /bin/bash myusername
[root@myhostname ~]# passwd myusername

Install sudo so that users in the wheel group can use sudo.

[root@myhostname ~]# pacman -S sudo
[root@myhostname ~]# vim /etc/sudoers
[root@myhostname ~]# cat /etc/sudoers
...
##
## User privilege specification
##
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
 %wheel ALL=(ALL) ALL
...

Login as a local user

[root@myhostname ~]# exit
myhostname login : myusername
passwd

Install and enable openssh

[myusername@myhostname ~]# sudo pacman -S openssh
[myusername@myhostname ~]# sudo systemctl enable sshd

Finally

Arch Linux was installed in RAID1 storage in an environment booted by BIOS boot, and settings were made to the point where it could be operated externally with ssh. Detailed explanation is [Installation Guide-ArchWiki](https://wiki.archlinux.jp/index.php/%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3 % 83% BC% E3% 83% AB% E3% 82% AC% E3% 82% A4% E3% 83% 89) and RAID-ArchWiki / RAID).

Recommended Posts

Arch Linux install to RAID1 storage (BIOS boot)
Arch Linux install to BIOS boot system
Install Arch Linux on DeskMini A300
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
How to install MBDyn (Linux Ubuntu)
How to install aws-session-manager-plugin on Manajro Linux
5 reasons to install Linux on your laptop.
How to install Anisble on Amazon Linux 2
How to install Windows Subsystem For Linux
How to install php7.4 on Linux (Ubuntu)
Until you install Arch Linux on VMware
Add Windows to the Linux OS boot menu
Deliver OBS footage to Zoom on Arch Linux
How to install Camunda Modeler on Manjaro Linux
Linux LVM RAID
[Linux] Introduction to Linux
Arch Linux Recommendation
Install Grub on USB memory (UEFI) ~ Boot Linux from grub on USB memory ~
How to use C216 Audio Controller on Arch Linux
How to install Linux on a 32bit UEFI PC
I will install Arch Linux for the time being.
Install Docker on Arch Linux and run it remotely
[AWS EC2] How to install Maven on Amazon Linux 2
Introducing a desktop environment to Arch Linux (LightDM + Xfce4)
How to install git on Linux such as EC2