Re: SOLVED: Software-RAID1 on sarge (AMD64)
Kilian <email@example.com> writes:
> In the last few days, I was struggling to convert a remote machine
> with two identical SATA disks (sda and sdb) to a Software RAID
> 1. Especially the boot-part was tricky as I had no console access to
> the machine. The whole procedure was done remotely via SSH. I use the
> md tools (mdadm) and lilo as bootloader. I chose LILO because IMHO
> it's more straightforward in this setup than GRUB and I have no other
> Operating Systems I would want to boot.
> The system was installed on the first disk, the second one has not
> been used before. Those are the steps I went through:
> 1. Install a Software-RAID capable kernel and boot the system with it;
> Install the md tools: 'apt-get install mdadm';
Meaning any Debian kernel. :)
> 2. partition the second harddrive (sdb). I created two partitions, a
> large one at the beginning of the disk (sdb1) and a small
> swap-partition at the end (sdb2). I do not use separate /boot
NOTE: disk speed differs by around a factor of 2 between start and
end. Which one is the fast one can depend on the disk but usualy the
start is. Better swap there.
> NOTE: I do not use two swap spaces on the two disks; instead, I
> create a RAID array consisting of the two smaller partitions on the
> two discs and create the swap space on it. In case of a disk
> failure, I don't need to reboot the system because the swap space
> is also on RAID. Otherwise, a disk failure would toast one swap
> space, probably leaving the system in a unusable state until
It would cause processes to segfault all over and take down the system.
> Important: both partitions need to be of the type 0xFD "Linux raid
Actualy not. mdadm can work just as well without it. Doesn't hurt though.
> 3. Create the RAID arrays:
> $ mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1
> $ mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb2
> 4. Create filesystems
> $ mkfs -t xfs /dev/md0
> $ mkswap /dev/md1
> I use XFS as filesystem because it has such nice features as online
> resizing etc and is, IMHO, very stable and mature. Of course you can
> use whatever you like.
As does ext3, even more so.
> 5. Copy the existing Debian system to the new RAID
> $ mkdir -p /mnt/newroot
> $ mount /dev/md0 /mnt/newroot
> $ cd /
> $ find . -xdev | cpio -pm /mnt/newroot
Fun, fun. A copy of /proc. That's a few Gig wasted depending on the
size of /proc/kcore.