Ubuntu Raid
From Liki
This article is about getting RAID to work in Ubuntu, especially for system disks.
Contents |
Raid Migration
My first attempt was to do a regular install, then migrate to raid. The result was the kernel not being able to access root. After a long time trying to work this through I made no progress and so I deem this a failure.
Raid on Install
So, my second attempt was to RAID from the start. First, the normal graphical install disk does not include RAID tools, so you will have to use the alternative install disk with the text-based installer (On the Ubuntu download page there is a check-box to get the alternative disk). The install is not significantly different in text-mode, though.
Partitioning
Now, I had an awful time getting the partition manager to handle the RAID correctly, so I went for a manual approach. Once the installer gets to the point of asking for a computer name, hit alt+(right arrow) to get to a terminal where you can do the manual procedures (you have to wait till this point because not all the disk utilities are available until then)
First, I used fdisk to partition my disks as follows:
/dev/sda1 +100M fd /dev/sda2 +4G 82 /dev/sda3 +40G fd /dev/sda4 <rest> fd
where the partitions will be /boot, swap, /, and /home and the types are fd (linux raid autodetect) except for the swap partition, which is swap.
Instead of partitioning the second drive I copied over the partition table instead:
dd if=/dev/sda of=/dev/sdb count=1 fdisk /dev/sdb w
where I ran fdisk to just write the partition table just to be safe. Also, you should flag the boot partitions of both drives as bootable.
Setting up RAID
Next I want to setup the actual RAID devices. First, the device nodes probably wont already by in /dev so you'll have to create them manually (MAKEDEV is not available on the disk it seems):
for i in 0 1 2; do mknod /dev/md$i b 9 $i;done
This will make /dev/md0 ... /dev/md2 for you. I have only made 3 devices because swap will not be raided (who needs to backup their swap space?) But we will be doing something cool with swap later...
Ok, now to create the arrays with mdadm:
mdadm -C /dev/md0 --assume-clean -l1 -n2 /dev/sda1 /dev/sdb1 ...
and repeat this for every md you want to have. -C says to create the array, and next part is the array name to create, assume-clean removes the initial disk syncing which saves a lot of time for large disks and really shouldn't be necessary when there is nothing on the disks (although, this is not officially recommended and 'may not work' - you have been warned :), -l1 is for RAID Level 1 (mirroring) -n2 means two devices, and finally the devices in the array.
Continue Install
Once mdadm is done with the setup, continue on with the installation procedure as normal (hit alt+(left arrow) to get back to the installer). When you get to the disk partitioner, the raid devices should show up. Assign the partitions on the raid devices an appropriate file system and mount point - DO NOT assign the physical drive partitions /dev/sda1 etc... except for the swap partitions (there should be no raid device for the swaps). Set both swap partitions on the disks to swap.
Then, carry on till the end and reboot.
Likely Problem
Now, when the computer reboots you'll probably get stopped after a few second and get dropped to a busybox prompt. If you do alt+{right arrow) you will see some error information relating to mdadm not finding the disks.
Reboot the machine and when grub comes up hit esc to get to the menu. Go to the recovery entry and hit 'e' to edit the line. Change the kernel line from root=/dev/md2 to root=/dev/sda3, but use the appropriate numbers in your case (ie, the root partitions on your system). Hit enter and then 'b' to boot this line. You should have no trouble booting and eventually get to a root prompt. What is nice about this method is that the fstab should be set up for raid, so your computer will have all the raid devices mounted correctly.
Now, run
dpkg-reconfigure mdadm
and when you get a screen. Hit 'ok' and in the next screen type in md2, or whatever RAID is root. Configure the other options as you want (I said start devices and run the monitor). Then update-initramfs should be run automatically.
Reboot. You should have a nice RAID system.
Possible Further Trouble
If you still have trouble, then do the following: reboot and edit the grub commandline again to boot from sda, only this time you may have to change in initrd line by adding '.bak' after the image name, for example
initrd /initrd.img-2.6.20-15-generic
becomes
initrd /initrd.img-2.6.20-15-generic.bak
Hit enter and 'b' to boot this kernel. You can try booting first without this second change and change it if it hangs again.
Once you've got a prompt go do
cd /usr/share/initramfs-tools/scripts/init-premount echo '/sbin/udevsettle --timeout=10' >> udev
This will give udev time to setup the initial raid devices before plunging ahead with booting.
Swap
To see your current swap usage do
swapon -s Filename Type size Used Priority /dev/sda2 -1 /dev/sdb2 -2
Which means it will use the first disk first, then when it's full go on to the second. What we really want is for the two swaps to be used in parallel for increased speed. We do this by editing the fstab by adding 'pri=1' to the options:
... #/dev/sda2 UUID=#### none swap sw,pri=1 0 0 #/dev/sdb2 UUID=#### none swap sw,pri=1 0 0 ...
You can the reset the swap in place by
swapoff -a swapon -a
So that you should get:
swapon -s Filename Type size Used Priority /dev/sda2 1 /dev/sdb2 1
indicating simultaneous use.
The End. my trans manfaat madu manfaat internet pengertian internet edit foto online manfaat minyak zaitun
kata bijak inggris kata bijak cinta kata mutiara inggris kata mutiara cinta kahlil gibran kata mutiara lucu kata mutiara sahabat kata mutiara cinta kata mutiara cinta bahasa inggris kata mutiara cinta romantis waptrick wapdam wapday mozilla terbaru komputer bekas waptrick trans 7 online rcti online sctv online mnc tv online indosiar online tv online indonesia

