Digitalogy Blog

Blog Stiri IT

Installing Slackware 14.2 on a Linux Software RAID 1

Installing Slackware 14.2 on a Linux Software RAID 1

Installing Slackware 14.2 on a Linux Software RAID 1 (MIRRORING)

 

This how you’ll install Slackware Linux 14.2 on a RAID 1 (mirrored) drive. ( Pentru Romana navigati mai jos. – For Romanian language scroll down. )

Boot the system with Slackware 14.2 ISO and then when prompted, choose the appropriate keyboard type. To login type root and press enter. To view the disks :

# fdisk –l

In your system must be 2 identical HDD or the size of the smallest disk will become the size of the final RAID array. The plan is to create two Linux software RAD 1 arrays. The first one will be used as the / (root) partition and the next one will be used as swap partition.

I won’t use images.. so I’ll pretend that those 2 HDD are /dev/sda and /dev/sdb

To achieve this we’ll partition the first drive /dev/sda using the cfdisk utility :

# cfdisk /dev/sda
Set up new partition with the size – whatever you think is suitable in your layout
Select TYPE while the new partition is highlighted and select fd00 ( Linux Raid ) . Don’t forget to save space for swap partition.
Set up another new partion with at least or twice of your RAM size, select again type fd00 ( Linux Raid)

WRITE partition table and QUIT cfdisk

We can verify that the partition table of /dev/sda is written correctly by using the fdisk –l command :

# fdisk –l /dev/sda

The next step is to copy the partition table of /dev/sda into /dev/sdb by using the sfdisk utility. This can be done using the following command :

# sfdisk –d /dev/sda | sfdisk –-force /dev/sdb

Now sda and sdb have identical partition table – verify with fdisk :

#fdisk –l /dev/sda

#fdisk –l /dev/sdb

 

The cat /proc/mdstat command will show us that there are  currently no RAID arrays present in the system :

Linux Terminal

Now we’ll create the raid arrays using the mdadm utility.

To create the first RAID array that will be used as / (root) partition we can use the following command :

# mdadm -C /dev/md0 –l 1 –e 0.90 –n 2 /dev/sda1 /dev/sdb1

We can view the status of the newly created RAID device using:

# cat /proc/mdstat 

You’ll see md0 : active

Similarly, we ‘ll create the RAID device /dev/md1 which will be used as our swap partition using the following command:

# mdadm -C /dev/md1 –l 1 –e 0.90 –n 2 /dev/sda2 /dev/sdb2

Now we’ll make md1  – swap partition

# mkswap /dev/md1

now we are ready to start setup

# setup

Setup Slackware 14

Choose the ADDSWAP.  The /dev/md1 partition will be detected as swap.

When prompted for “Check SWAP Partitions for BAD Blocks” , chose NO.

In the TARGET we will chose /dev/md0 as the / (root) partition.  We will choose to Format it and the EXT4  file system is chosen.

SOURCE  – install Slackware from  CD or DVD / USB

SELECT the packages and then begin the installation ( if not sure select all – full install )

Install lilo automatically –  use master boot record.

Finish your setup, set your password.

After the installation is finished we drop to the install shell and then chroot to the newly installed Linux partition by using the following command:

# chroot /mnt/ /bin/bash

# vi /etc/lilo.conf

Change the line:

boot = /dev/sda

With those two lines :

boot = /dev/md0

raid-extra-boot=”/dev/sda,/dev/sdb”

Save and quit

Install lilo with new configuration :

# lilo -v

Reboot the system :

# reboot

After we have booted into the freshly installed Slackware, check the status of the raid array:

# mdadm –detail /dev/md0

# mdadm –detail /dev/md1

Generate the mdadm.conf file. We can do this by using :

# mdadm –detail –scan > /etc/mdadm.conf

And.. That’s it!

 

 

Cum se instaleaza Slackware 14.2 –  RAID 1 SOFTWARE (MIRRORING)

 

Boot-am cu cd sau stick Slackware 14.2.

Pentru a va loga scrieti root si apasati enter.

Pentru a vedea hard-discurile :

# fdisk –l 

In system trebuie sa aveti 2 HDD identice, sau cel mai mic disc va devein marimea RAID-ului. Ideea este sa facem 2 imagini RAID 1, prima va fi folosita ca partitie root, iar urmatoarea ca swap.

Nu voi folosi imagini, imaginati-va ca cele doua HDD se vad sub forma /dev/sda and /dev/sdb.

Tastati :

# cfdisk /dev/sda
Se seteaza o partitie noua – cat credeti ca este sufficient pentru nevoile voastre ( instalarea tuturor pachetelor va ocupa in jur de 10GB )
Selectati TYPE apoi fd00 ( Linux Raid ) . Nu folositi tot spatiul pentru prima partitie, mai avem de facut si partitia swap.
Setam o noua partitie pentru swap cu minim capacitatea RAM-ului, indicat ar fi de 2 ori capacitatea RAM-ului, selectam din nou TYPE fd00 ( Linux raid)

WRITE si QUIT cfdisk

Putem verifica daca tabelul de partitii este correct folosind comanda fdisk:

# fdisk –l /dev/sda

Acum vom copia tabela de partitii /dev/sda in /dev/sdb folosind sfdisk.

# sfdisk –d /dev/sda | sfdisk –-force /dev/sdb

Acum ambele hard-discuri au tabele de partitii identice. Verificam cu fdisk :

#fdisk –l /dev/sda

#fdisk –l /dev/sdb

Cu comanda:

# cat /proc/mdstat

vom verifica daca mai sunt “imagini” RAID in sistem

Linux Terminal

Nu avem. Vom face primul RAID cu mdadm :

# mdadm -C /dev/md0 –l 1 –e 0.90 –n 2 /dev/sda1 /dev/sdb1

Putem vedea rezultatul folosinf comanda :

#cat /proc/mdstat 

Vom vedea md0 : active

In acelasi mod vom crea /dev/md1 pe care mai tarziu o vom configura ca swap:

# mdadm -C /dev/md1 –l 1 –e 0.90 –n 2 /dev/sda2 /dev/sdb2

Acum configuram /dev/md1 ca swap :

# mkswap /dev/md1

Acum intram in procesul de instalare :

# setup

Setup Slackware 14

Alegem ADDSWAP.   /dev/md1 va fi detectata ca swap. “Check SWAP Partitions for BAD Blocks” – Alegem NO.

TARGET – vom alege /dev/md0 ca / (root) partition.  O formatam cu EXT4

SOURCE  – Alegem dispozitivul de pe care se va face instalarea CD sau DVD / USB.

SELECT – se selecteaza pachetele pe care le doriti si se incepe instalarea ( daca nu sunteti siguri de ceea ce doriti alegeti full install )

Se instaleaza lilo automat –  folosim master boot record – MBR

Instalarea s-a terminat –  setati parola.

Dupa instalare intram in linia de comanda pentru a modifica lilo :

# chroot /mnt/ /bin/bash

# vi /etc/lilo.conf

Schimbam linia de mai jos:

boot = /dev/sda

cu cele 2 linii de mai jos :

boot = /dev/md0

raid-extra-boot=”/dev/sda,/dev/sdb”

Save si quit

Instalam lilo cu noua configuratie :

# lilo -v

reboot-am sistemul :

# reboot

Dupa ce boot-am prima data in Slackware-ul nou instalat, verificam RAID-ul:

# mdadm –detail /dev/md0

# mdadm –detail /dev/md1

Generam fisierul mdadm.conf:

# mdadm –detail –scan > /etc/mdadm.conf

Si… asta e.

Pin It

Add comment