Arch Linux is a general-purpose Linux distribution for x86-64 computers and is very popular among the intermediate and advanced Linux users. It is free and open-source software. In this blog, we will check out how to install Arch Linux by setting software RAID 1.

Install Arch Linux

Download the iso

We can download the latest version of OS from the Arch Linux official website

https://www.archlinux.org/download/

 

Setup bootable USB and Boot from it

Setup a bootable USB or CD using the downloaded iso.

Power on the system and press F2 or F11  (Depends on the motherboard) to change/select the boot order.

Select the boot option accordingly to boot from the USB or CD drive.

Once the system boots, you will get an OS installer screen.

Choose Boot Arch Linux (x86_64) from the installer screen and then press Enter.

After various checks performed, you will get a root login prompt.

 

Setup the Network

You need internet connectivity to continue installing OS on the system. If you are using a DHCP environment system will detect the network automatically. If you are using a static IP address, you need to configure it manually as mentioned below:

ip addr flush dev enp1s0
ifconfig enp1s0 172.178.2.10 netmask 255.255.255.0
route add default gw 172.178.2.1
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Replace network card and IP address according to your network environment.

 

Partition the Disks

Here we need to setup Software RAID 1 which means data mirroring. You can check out more details about Software RAID and its setup using below links:

https://www.serveradminz.com/blog/differences-software-raid-hardware-raid/
https://www.serveradminz.com/blog/how-to-setup-raid-1-in-linux-using-mdadm/

We are using mdadm command to setup RAID among disk. To create Software RAID 1 we use below command:

mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sd[a-b]1

Here we create a Raid device called /dev/md0. You can change the name according to your need.

Then we use the parted command to create partitions. Please don’t copy paste the exact commands as I mentioned below. You have to modify the device name and other things according to your system.

parted /dev/md0

mklabel msdos                                                                             #(Create an MS-DOS disk label)

mkpart primary ext4 1MiB 500MiB                                    #(Creating a 500 MB partition for /boot)

set 1 boot on

mkpart primary linux-swap 500 MiB 8.5G                   #(Creating an 8 GB partition for swap)

mkpart primary ext4 8.5G  100%                                     #(Set the remaining space for / partition)

quit     (Exit from parted)

To see partition changes run below command:

fdisk -l  /dev/md0

Create the Filesystem

Format the created partitions with the file systems you need

mkfs.ext4 /dev/md0p1

mkfs.ext4 /dev/md0p3

mkswap  /dev/md0p2

Mount the Partitions

Then we need to mount the partitions to desired mount points.

swapon  /dev/md0p2

mount  /dev/md0p3  /mnt

mkdir -p /mnt/boot

mount  /dev/md0p1  /mnt/boot

If you have additional partitions you can mount the respective directories on /mnt. For Ex: /home1 partition needs to be mounted on /mnt/home1

 

Install Arch Linux Base System

Run below command to Install Arch Linux

pacstrap /mnt/ base base-devel

The installation will take at least 10 to 20 minutes depending upon your network speed.

 

Create fstab Entries

Once the installation completed we need to create fstab entries for the installed OS.

genfstab -U /mnt > /mnt/etc/fstab
nano /mnt/etc/fstab (replace UUIDs with device name. Ex: /dev/md0p1, /dev/md0p2)

Update mdadm conf

Now update the mdadm conf file to the installed OS to save the Raid configuration we have created.

mdadm --detail --scan --verbose   >>   /mnt/etc/mdadm.conf

Configuration Arch Linux System

To configure Arch Linux we need to chroot to the new system. The chroot changes the root directory for the currently running process.

 

Set System Language & Time

Configure the system language by un-commenting the required languages from locale.gen file.

vi /etc/locale.gen             #(Uncomment en_US.UTF-8 UTF-8 for American-English.)
locale-gen                               #(Generate the locale)

Set the system locale by using the LANG variable in /etc/locale.conf file.

echo "LANG=en_US.UTF-8"  > /etc/locale.conf

Configure the system time zone by creating a symlink.

ln -sf /usr/share/zoneinfo/US/Central /etc/localtime

Set the hardware clock to UTC.

hwclock --systohc --utc

Set root password

Use passwd command to set the root password

passwd

Work on some grub stuff

We need to install GRUB at first

pacman   -Sv    grub

nano /etc/default/grub     #(Uncomment GRUB_DISABLE_LINUX_UUID=true)

Now edit mkinitcpio.conf file. Add mdadm_udev to HOOKS and /sbin/mdmon to BINARIES

nano /etc/mkinitcpio.conf
HOOKS="base udev autodetect modconf block mdadm_udev filesystems fsck"
BINARIES="/sbin/mdmon"

Regenerate the file to reflect changes

mkinitcpio -p linux

Install GRUB Boot Loader

grub-install /dev/sda &&  grub-install /dev/sdb
grub-mkconfig -o /boot/grub/grub.cfg

Setup Hostname

Now we need to create a hostname for the system by adding an entry in the /etc/hostname file

echo your-hostname > /etc/hostname

Reboot

The installation has been completed. Now its time to reboot the system and boot it to the newly installed OS

Exit from chroot and perform the Reboot
exit
reboot

The system will boot to the installed OS after the reboot. You can use root as username and password you have provided during the setup process to log in.

[tagline_box backgroundcolor=”description=” shadow=”no” shadowopacity=”0.7″ border=”1px” bordercolor=”” highlightposition=”top” content_alignment=”left” link=”” linktarget=”_self” modal=”” button_size=”” button_shape=”” button_type=”” buttoncolor=”” button=”” title=”” description=”If you have any queries on Installation Of Arch Linux Using Software RAID feel free to leave us a message and our representative will get back to you.

” margin_top=”50px” margin_bottom=”” animation_type=”slide” animation_direction=”left” animation_speed=”0.3″ class=”” id=””]

    [/tagline_box]