Moving a server over to a RAID
luis.barbas at gmail.com
Mon Aug 23 11:41:38 UTC 2010
On Sat, Aug 21, 2010 at 7:45 PM, Mike A. Leonetti
<mikealeonetti at gmail.com> wrote:
> (2010年08月20日 19:08), Luis Paulo wrote:
>> On Fri, Aug 20, 2010 at 4:40 AM, Mike A. Leonetti
>> <mikealeonetti at gmail.com> wrote:
>>> Not to knock your idea, but it actually made me a bit confused reading
>>> it lol. It seems like more work than just copying it straight up and
>>> then modifying the boot stuff afterwards.
>> lol. No problem :)
>> Give it a try your away and tell us about it.
>> I think "modifying the boot stuff" will be, at least, grub and boot
>> image with a mdadm array. My point was that an install will do most of
>> it for you.
>> And you did ask "Also, would anybody else handle the situation differently" :)
>> Best wishes
> Well. I thank everybody for the feedback. This is what I ended up doing.
> A lot of this was taken from the guide that Preston Hagar gave me
> 1) Booted up to a Gentoo LiveCD
> 2) Formatted the two new drives (which showed up as /dev/sda and /dev/sdb)
> using fdisk /dev/sda and then creating two partitions, sda1 which took
> up everything on the drive except swap space near the end. Then sda2
> which was the rest of the swap space. I set the partition 1 (sda1) to
> active and the type to fd (autodetect raid) and then sda2 to 82 (Linux
> Then I sfdisk -d /dev/sda | sfdisk /dev/sdb to copy that to the other drive.
> Of course ran mkswap on both /dev/sdb2 and /dev/sda2
> 3) Created the RAID:
> mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1
> Then formatted /dev/md1 ext3.
> 4) Mounted the new RAID and the old drives to /mnt/copyfrom and /mnt/copyto
> 5) Copied the data using cp -va
> cp -va /mnt/copyfrom/. /mnt/copyto/.
> 6) Prepared my chroot
> mount -o bind /dev /mnt/copyto/dev
> mount -t proc none /mnt/copyto/proc
> 7) Chrooted into /mnt/copyto
> chroot /mnt/copyto /bin/bash
> 8) Set up grub properly.
> Edit /boot/grub/device.map to contain both:
> (hd0) /dev/sda
> (hd1) /dev/sdb
> Then I ran this:
> tune2fs -l /dev/md1 | grep UUID
> to get the UUID of the RAID array then modified that value to what was
> already in /boot/grub/menu.list. It seems that Ubuntu boots off the
> drive's UUID and not /dev/md1. I guess you could add /dev/md1 instead
> but I didn't.
> grub-install /dev/sda
> grub-install /dev/sdb
> 9) At this point I had to install mdadm to my system because it wasn't
> in there already. Since the Gentoo livecd had me on the internet I was
> able to:
> apt-get update
> apt-get install mdadm dmsetup
> 10) Edited /etc/fstab
> /lib/udev/vol_id /dev/md1
> Gets the volume ID again. Then replaced my / mount drive with that UUID
> instead. Then deleted what was in there for swap and added /dev/sda2 and
> /dev/sdb2 as swap.
> 11) At this point you should probably run:
> mdadm --detail --scan >> /etc/mdadm/mdadm.conf
> update-initramfs -u
> But when I installed mdadm in step 9 it actually created everything for
> me so I didn't have to.
> 12) Lastly I just shut down the system, took out the old drive and
> booted it back up. Worked like a charm.
Just a note for the guide.
Since Karmic vol_id was replaced by blkid. So, for those releases, on 10)
# blkid /dev/md1
More information about the ubuntu-users