sobota 9. února 2008

Ubuntu 7.10: server install from network on software RAID1

Okay, so I am writing the steps I took to get Ubuntu 7.10 Server on my computer. I had to use the installation from the network as I am not able to boot from CD (have a look here why). As I was unsuccessful last time I started from scratch.

(The first part is taken from this tutorial)
1. let's say you have Windows XP
2. create folder C:\boot
3. download files linux and initrd.gz to c:\boot
4. Download Grub4Dos from project page on sf.net
5. unzip grub4dos-0.4.3.zip
6. Copy c:\boot\grub4dos-0.4.3\grldr to C:\
7. create folder C:\boot\grub
8. Copy c:\boot\grub4dos-0.4.3\menu.lst to C:\boot\grub
9. Open Command Line: Start - Run - cmd
10. run attrib -a -r -s -h c:\boot.ini in the command line
11. run notepad c:\boot.ini in the command line
12. add C:\grldr="Start GRUB" at the end of boot.ini and save it
12. return to the command line and run notepad c:\boot\grub\menu.lst
13. to the end of the file add
title Ubuntu Installer (hd0,0)
kernel (hd0,0)/boot/linux vga=normal ramdisk_size=14972 root=/dev/rd/0 rw --
initrd (hd0,0)/boot/initrd.gz
and save it
14. remove CD and floppy and restart
15. when booting choose Start GRUB option from Windows loader (press F8 to get there)
16. after a while you should see GRUB4DOS window. Select the last option Ubuntu Installer (hd0,0)
17. Ubuntu installer should start after a while (Choose language)
18. Configure everything and choose also your network mirror
19. The installer should stop at "Partition disks"
20. We need to create 2 same layouts on both disk - the easiest thing how to do this is to create partitions RAID partitions from the end on both disk (8GB let say), do not forget to set the type to Linux raid autodetect
21. We also need to have a partition with root filesystem so let's create it on the second disk from the beginning the same size as Windows partition
22. Once installed, you can reboot and have your system running
23. run sudo fdisk -l to make sure the partitions are the same size and the correct type Linux raid autodetect
24. download the software raid tools sudo apt-get install mdadm
25. create the RAID by sudo mdadm --create /dev/md0 -l 1 -n 2 /dev/sda2 /dev/sdb1
26. format the new disk by sudo mkfs -t ext3 /dev/md0
27. mount the new disk sudo mount /dev/md0 /mnt/
28. we have to copy all the data from current root (e.g. /dev/sdb2) to the new disk: su
tar cl --exclude=/media/sda1 -–exclude=/proc -–exclude=/mnt -–exclude=/sys / | tar xvC /mnt
exit
. You should ommit --exclude /media/sda1 if windows partition is not mounted. You should not ommit the other excludes. You might check the status cat /proc/mdstat
29. we have to change fstab of the newly to-be-booted system by sudo nano /mnt/etc/fstab. Change the beginning of the line with / from something like UUID=03... to /dev/md0.
30. create ommited folders sudo mkdir /mnt/proc /mnt/sys; sudo chmod 555 /mnt/proc
31. it the RAID partition on the same disk as the original bootable partition is not set as bootable, set it sudo fdisk /dev/sdb and then a 1 and w.
32. we have to change booting with GRUB so sudo nano /boot/grub/menu.lst. Find the default entry, copy the lines before the default entry and change root (e.g. from root (hd1,1) to the new RAID partition on the same disk root (hd1,0)). Also change kernel line from root=UUID=xycxcxy... to root=/dev/md0.
33. copy changed file to mnt as well sudo cp /boot/grub/menu.lst /mnt/boot/grub/menu.lst
34. change /etc/mdadm/mdadm.conf by

su
mdadm --examine --scan > /tmp/mdadm.conf
cat /tmp/mdadm.conf >> /etc/mdadm/mdadm.conf
cp /etc/mdadm/mdadm.conf /mnt/etc/mdadm/mdadm.conf
exit

35. change /usr/share/initramfs-tools/init by sudo nano /usr/share/initramfs-tools/init and add line /sbin/mdadm --assemble --scan before mountroot
36. build init by sudo update-initramfs -k all -u. copy sudo cp /boot/initrd.img-2.6.22-14-generic /mnt/boot/initrd.img-2.6.22-14-generic.
37. install grub to the boot sector sudo grub-install /dev/sda and sudo grub-install /dev/sdb.
38. reboot. You should be up and running. Check by mount - the / partition should be /dev/md0, if you check cat /proc/mdstat you should see md0 : active.

Hope you find this helpful and enjoy it. If something is going wrong, you can always boot the second option,mount your RAID on /mnt and go through the files. You still need the original linux partition as it contains boot files.

Žádné komentáře: