Cum sa facem software Raid Mirror in RHEL 6

Configurare noua (How To)

Situatie

Prima oara trebuie sa stim faptul ca sda este primul HDD iar sdb este al doilea.

Pentru a face asta urmam pasii:

  • Partitionare
  • Configurare boot device
  • Creeare swap nou pe device
  • Configurare LVM
  • Configurare Grub

Solutie

 

Primul pas, Partitionare, facem urmatorul lucru:

sfdisk -d > disks.out
sfdisk /dev/sdb <disks.out

parted /dev/sda set 1 raid on
parted /dev/sda set 2 raid on
parted /dev/sda set 3 raid on
parted /dev/sda set 5 raid on

parted /dev/sdb set 1 raid on
parted /dev/sdb set 2 raid on
parted /dev/sdb set 3 raid on
parted /dev/sdb set 5 raid on

mdadm –create /dev/md0 –level=1 –raid-disks=2 missing /dev/sdb1 –metadata=0.90
mdadm –create /dev/md1 –level=1 –raid-disks=2 missing /dev/sdb2 –metadata=1.0
mdadm –create /dev/md2 –level=1 –raid-disks=2 missing /dev/sdb3 –metadata=1.0
mdadm –create /dev/md3 –level=1 –raid-disks=2 missing /dev/sdb5 –metadata=1.0

Dupa acest pas trebuie sa configuram bootarea:

mkfs.ext4 /dev/md0

mkdir /mnt/md0
mount /dev/md0 /mnt/md0
cp -dpRx /boot/* /mnt/md0
sync
umount /mnt/md0
rmdir /mnt/md0

umount /boot
mount /dev/md0 /boot

mdadm /dev/md0 -a /dev/sda1

mdadm -D /dev/md0

Gasim UUID folosind comanda:

blkid |grep md0
/dev/md0: UUID=”d43e4912-57b3-456a-8ef2-af747d37bead” TYPE=”ext4″

O actualizam in /etc/fstab:

# grep boot /etc/fstab
#UUID=3428cd4c1-c81b-4d94-240b-12f9020e870e /boot ext4 defaults 1 2
UUID=d43e4912-57b3-456a-8ef2-af747d37bead /boot ext4 defaults 1 2

Verificam daca ambele disk-uri sunt listate in /boot/grub/device.map, sau le adaugam daca este necesar.

cat /boot/grub/device.map
(hd0) /dev/sda
(hd1) /dev/sdb

Instalam grub pe ambele device-uri:

grub-install /dev/sda
grub-install /dev/sdb

Creeam un nou swap device:

mkswap /dev/md1
swapoff /dev/sda2

mdadm –add /dev/md1 /dev/sda2
swapon /dev/md1
blkid | grep md1

Actualizam  /etc/fstab file.

Configurare LVM

pvcreate /dev/md2
pvcreate /dev/md3
vgextend ROOTVOL /dev/md2
vgextend ROOTVOL /dev/md3

pvmove /dev/sda3 /dev/md2
pvmove /dev/sda5 /dev/md3

vgreduce ROOTVOL /dev/sda3
vgreduce ROOTVOL /dev/sda5

pvremove /dev/sda3
pvremove /dev/sda5

mdadm /dev/md2 -a /dev/sda3
mdadm /dev/md3 -a /dev/sda5

mdadm –examine –scan >/etc/mdadm.conf

Configurare Grub
Stergem linia rd_NO_MD din /boot/grub/grub.conf

dracut -f

rm -f /etc/lvm/cache/.cache
vgscan

Intram in grub:

grub
grub> find /grub/grub.conf
root (hd0,0)
setup (hd0)
root (hd1,)
setup (hd1)
quit grub

Va doresc o zi cat mai placuta.

Tip solutie

Permanent

Voteaza

(35 din 78 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?