Installation de la tête du cluster Headless

From NBSWiki

Jump to: navigation, search

Quelques notes personnelles usr la mise-à-jour / migration de Headlesss:

Contents

Partition

livecd ~ # sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=   401562, Id=fd
/dev/sda2 : start=   401625, size=  1975995, Id=fd
/dev/sda3 : start=  2377620, size=310118760, Id=fd
/dev/sda4 : start=        0, size=        0, Id= 0

On duplique sur les 4 autres disques du RAID initial:

for I in b c d; do sfdisk -d /dev/sda | sfdisk /dev/sd$I; done

Init RAID

mdadm --create --verbose /dev/md2 --level=1 --raid-devices=4 /dev/sd[abcd]1
mdadm --create --verbose /dev/md3 --level=5 --raid-devices=4 /dev/sd[abcd]2
mdadm --create --verbose /dev/md4 --level=5 --raid-devices=4 /dev/sd[abcd]3

Format MD devices

Boot

RAID1 all across, else it's not bootable

livecd ~ # mke2fs /dev/md2
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
50200 inodes, 200704 blocks
10035 blocks (5.00%) reserved for the super user
First data block=1
25 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

SWAP

RAID5, so if one disk fails, the system stays alive:

livecd ~ # mkswap /dev/md3
Setting up swapspace version 1, size = 3034836 kB
no label, UUID=e2f38a74-537f-4c5d-9e47-98520b9401ac

ROOT

RAID5

livecd ~ # mkreiserfs /dev/md4
mkreiserfs 3.6.19 (2003 www.namesys.com)

A pair of credits:
Many persons came to www.namesys.com/support.html,  and got a question answered
for $25, or just gave us a small donation there.

Jeremy  Fitzhardinge  wrote  the  teahash.c  code  for  V3.  Colin  Plumb  also
contributed to that.


Guessing about desired format.. Kernel 2.6.17-gentoo-r7 is running.
Format 3.6 with standard journal
Count of blocks on the device: 116294448
Number of blocks consumed by mkreiserfs formatting process: 11761
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 62f8f7d9-91ad-4fa5-aa95-105cc1cce57f
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
        ALL DATA WILL BE LOST ON '/dev/md4'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/md4.

Migration des données

Préparation des répertoires

livecd ~ # mkdir /mnt/gentoo2
livecd ~ # mount /dev/md4 /mnt/gentoo2/
livecd ~ # mkdir /mnt/gentoo2/boot
livecd ~ # mount /dev/md2 /mnt/gentoo2/boot
livecd ~ # df -h
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                1007M  3.6M 1003M   1% /
/dev/hdc               50M   50M     0 100% /mnt/cdrom
/dev/loop0             44M   44M     0 100% /mnt/livecd
udev                 1007M  308K 1007M   1% /dev
tmpfs                  44M   44M     0 100% /mnt/livecd/lib64
tmpfs                1007M     0 1007M   0% /mnt/livecd/usr/portage
/dev/md/1              72G   14G   54G  21% /mnt/gentoo
/dev/md/0             236M   16M  208M   7% /mnt/gentoo/boot
/dev/md/4             444G   33M  444G   1% /mnt/gentoo2
/dev/md/2             190M   13K  180M   1% /mnt/gentoo2/boot

Copie de boot et du ROOT

livecd ~ # cp -a /mnt/gentoo/boot/* /mnt/gentoo2/boot/
livecd ~ # umount /mnt/gentoo/boot/ /mnt/gentoo2/boot/
livecd ~ # cp -a /mnt/gentoo/* /mnt/gentoo2/

Copie des données utilisateurs

On copies du disque externe sur le RAID5

livecd ~ # cp -a  /mnt/500G/gentoo/export/home/* /mnt/gentoo2/export/home/
livecd ~ # cp -a  /mnt/500G/gentoo/export/mysql /mnt/gentoo2/export/

GRUB

Installer sur tous les disques

ref: Gentoo-wiki Il faut installer GRUB sur tous les disques du RAID comme ça n'importe quel disque peut booter. On va forcer /dev/sd[abcd] comme étant (hd0) pour que chacun puisse être le HDD de boot:

grub --no-floppy
device (hd0) /dev/sda
root (hd0,0)
setup (hd0)
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)
device (hd0) /dev/sdc
root (hd0,0)
setup (hd0)
device (hd0) /dev/sdd
root (hd0,0)
setup (hd0)

Grub.conf

On va explicitement dire au kernel quels disques font quel RAID (md1) pour ne pas se retrouver avec un root sur "md5".

title=Gentoo
root (hd1,0)
kernel /vmlinuz root=/dev/md1 md=1,/dev/sda3,/dev/sdb3,/dev/sdc3,/dev/sdd3
Personal tools