I recently switched this server from running Gentoo Linux to Ubuntu Linux. In the process I only wanted to replace the OS and not loose my home directory and other data. 160G hard drives which are partitioned identically so that I can used RAID in a mirrored setup (RAID1). There are 4 partitions on the drive: a 10G primary partition which I had intended for windows but never used, 100M primary partition used as /boot, a 2G logical partition for the root filesystem (/), a 500M swap partition (Not raided gives me 1G of swap), and the rest ~151G used as LVM for the rest of the system.
Running # cat /proc/mdstat gives the following output:
Personalities : [raid1] md2 : active raid1 hde6 hdg6 147717568 blocks [2/2] [UU] md1 : active raid1 hde5 hdg5 1999936 blocks [2/2] [UU] md0 : active raid1 hde2 hdg2 96320 blocks [2/2] [UU] unused devices: <none>
Running # lvscan gives the following ouput:
ACTIVE '/dev/vg0/tmp' [2.00 GB] inherit ACTIVE '/dev/vg0/home' [20.00 GB] inherit ACTIVE '/dev/vg0/usr' [15.00 GB] inherit ACTIVE '/dev/vg0/local' [5.00 GB] inherit ACTIVE '/dev/vg0/opt' [5.00 GB] inherit ACTIVE '/dev/vg0/var' [5.00 GB] inherit ACTIVE '/dev/vg0/data' [88.87 GB] inherit
I wanted to format md0, md1, /dev/vg0/tmp, /dev/vg0/usr, /dev/vg0/local, /dev/vg0/opt, /dev/vg0/var, and keep the data on /dev/vg0/home, /dev/vg0/data. I did a backup of /etc for reference and /var/www because I would need to restore some stuff. I also backed up my mysql databases since they are also stored in /var. I did a backup of most of the important data on /dev/vg0/data and /dev/vg0/home. Some data I did not backup (media) because there was just too much of it.
Once all of my planning and backing up was done I booted with the Ubuntu Dapper Drake alternate i386 disk which is required for RAID and/or LVM configurations. My first supprise was that there was no GUI install. We were back to the Debian console install manager. Everything went smoothly until I got to the partitioning. It did not detect my existing RAID and LVM configuration. I was able to get my existing configuration up and running via the command line on another Virtual Terminal(VT), but by that point I had the installer wedged in a state where it just would not continue.
I had to reboot and start all over again. Here are the steps I took to get it working:
- boot the installer
- switch VTs to get a console
- run modprobe raid1
- run modprobe dm_mod
- run mdrun
- run vgchange -a y
- cat /proc/mdstat and lvscan should give output like above
- change back to the VT with the installer running in it
- continue with installer steps
- when you get to the partitioning step, it should recognise your raid and lvm devices
I ended up getting everything installed with no loss of data.