Migrating from i386 Debian Etch to amd64 Lenny using existing software RAID1 configuration

last update: 2009-03-06

The following toutorial describe how i sucesfully migrated from Debian Etch i386 to Debian Lenny amd64 :)

My old configuration:

Some time ago i decided to try 64-bit version of Debian. The target system is a server system. I had i386 Debian Etch on it. There was also kernel-based software RAID1 (mirror) on two same disks with same partition tables. The configration was following:
/dev/md0: /dev/sda1, /dev/sdb1; mount point: /
/dev/md1: /dev/sda5, /dev/sdb5; mount point: /usr
/dev/md2: /dev/sda6, /dev/sdb6; mount point: /var
/dev/md3: /dev/sda7, /dev/sdb7; swap
/dev/md4: /dev/sda8, /dev/sdb8; mount point: /tmp
/dev/md5: /dev/sda9, /dev/sdb9; mount point: /home
I like this partition scheme and i was going to make the same on new system.

The plan

In case of switching from i386 to amd64 it is recommended to install system from scratch. But i have a RAID1 configuration - so why not use this? :) So my plan was to disconnect second disk (to have system runnable in case if something goes wrong during instalation process). And then install the new fresh system on first disk. After installation - mount the second disk partitions, move the needed data and after some days - hot add second disk partitions to the base amd64 system as a raid devices. The one thing that i had to deal with was, that during some time my data was not mirrored at all. So i made a backup of most essential data on other machine before i started everything.

So - let's begin...

First thing was to definitely test if the mirrored disk (/dev/sdb) is working fine alone - especialy if it can boot into the grub, and then boot a system. So i disconnect /dev/sda SATA cable from mainboard and powered the server on. My old Debian boots fine - of course with information about missing (degradated) array. So i was shure that if something goes wrong during installation process i could always reconnect the old disk and have system working like before. This sure is very important to feel comfortable :)


I disconnect the working /dev/sdb from mainboard, and connected back the /dev/sda - on this disk i was going to install new Debian. I inserted thr Debian NETINST CD in amd64 version and started the fresh installation.
I repeated the installation steps on VirtualBox (for this tutorial need). The only difference is, that on screen is hda instead of sda and hdb instead of sdb.
After some basic installation steps I had partitioning screen:

i choosed "Manual" method

then "Configure Software RAID"

i agreed...

ooops - seems the kernel is using the swap - i choosed to continue (i'll fix it later)

i needed to delete all raid devices, but leave a 'raid autodetect' partitions - so i choosed "Delete MD device"

selected which array

... I repeated these steps for deletion of all raid devices ...

...but there was an error when deleting the array for swap...

ok - last device for device was 'md3_raid'... i skipped deletion process for now

... and selected "Finish" to go back to main screen

i'm back in main partition screen - you can see that there is still one RAID device for swap .. i selected it

and selected "Use as:"

... and "do not use the partition"

done :)

ok - here we go again :)

a confirmation

trying to delete again - now it works :)

then i'm at point where there is no raid devices at all

Now i needed to create new arrays


Number od devices: 2

Spare devices: 0

And - selected first partition and Continue
I repeated these steps for all arrays, and selected "Finish"

After select "Finish" - partitioner starts again

You can see that just created raid devices are now listed

I selected first raid device

selected "Use as:"

and choosed Ext3

i also want to format it

then i set the mount point

in this case - first partition - / root filesystem

i select done and set this partition
i repeated above steps for all my raid devices - of course with changing the mount point to have the disk and partition scheme like before

finaly, after settings all partitions i selected finish

final confirmation...

and final warning about the swap... continued

Then installation continued. When installer asked me for categories of software i would like to install i set nothing, and then Continue. It is of course not necesary but I like to have a control over installed packages - so i'm always installing only base system, and then the packages which i really need. This makes my system without a packages, which i don't know at all.

After installation finish i had installed new fresh Debian Lenny in amd64 architecture :)

Time to move data from old disk

I did a halt to power off the system, and i connected back my /dev/sdb, then booted new debian. I needed to mount partitions from second /dev/sda disk. So i typed:
mkdir /mnt/root
mkdir /mnt/usr
mkdir /mnt/var
mkdir /mnt/tmp
mkdir /mnt/home
Then new system don't know nothing about the array from the second (/dev/sdb) disk so i had to temporary run the old arrays:
mdadm --assemble --run /dev/md10 /dev/sdb1
mdadm --assemble --run /dev/md11 /dev/sdb5
mdadm --assemble --run /dev/md12 /dev/sdb6
mdadm --assemble --run /dev/md14 /dev/sdb8
mdadm --assemble --run /dev/md15 /dev/sdb9
Finaly i mounted the "old" arrays (for security - in read-only mode):
mount -o ro /dev/md10 /mnt/root
mount -o ro /dev/md11 /mnt/usr
mount -o ro /dev/md12 /mnt/var
mount -o ro /dev/md14 /mnt/tmp
mount -o ro /dev/md15 /mnt/home
And i have all my partitions mounted. Then it was a time to move needed data and configs.

Get the mirror back

After some days i was sure that new system is working correctly, so it was a time to get the mirror back to live. After unmounting the partitions I stopped all temporary created arrays:
mdadm --stop /dev/md10
mdadm --stop /dev/md11
mdadm --stop /dev/md12
mdadm --stop /dev/md14
mdadm --stop /dev/md15
And i added that devices to mirror:
mdadm /dev/md0 --add /dev/sdb1
mdadm /dev/md1 --add /dev/sdb5
mdadm /dev/md2 --add /dev/sdb6
mdadm /dev/md3 --add /dev/sdb7
mdadm /dev/md4 --add /dev/sdb8
mdadm /dev/md5 --add /dev/sdb9
After resync i have a server back on mirror and on amd64 debian system :) That's all folks :)


Feel free to mail me if you have any information/suggestions:
e-mail/jabber: manio@skyboo.net

© 2009 by manio