View Single Post
Old 25th July 2009, 16:01
newbuyer17 newbuyer17 is offline
Junior Member
Join Date: Feb 2008
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post

OK, I've been playing about with a vmware machine and the following seems to work:

Set up a system with /dev/md0 (sda1 and sdb1) as swap, /dev/md1 (sda2 and sdb2) as /

I used fedora 11
Install bootloader onto both drives

Boot as normal
Check status:
cat /proc/mdstat
prove that both disks used

Make a marker file:
touch /BOTH

Now fail drive B before we pretend to do upgrade

mdadm --manage /dev/md0 --fail /dev/sdb1
mdadm --manage /dev/md1 --fail /dev/sdb2
mdadm --manage /dev/md0 --remove /dev/sdb1
mdadm --manage /dev/md1 --remove /dev/sdb2

now do our pretend upgrade we just create a file we recognise

touch /UPGRADE

cat /proc/mdstat
and show that only drive A present

reboot to check again that only drive A used and / contains UPGRADE
cat /proc/mdstat
ls /

Now lets back out the upgrade

Boot from opensuse 11.1 liveCD
cat /proc/mdstat to show we still have only one drive used (A)

Let mount it to prove we currently have the upgraded system

mkdir /mnt/temp
mount /dev/md1 /mnt/temp
ls /mnt/temp
should show the UPGRADE file we created earlier so we know we are on the new upgraded system

unmount it again:
umount /dev/md1

now lets delete the md drives

mdadm --manage /dev/md0 --fail /dev/sda1
mdadm --manage /dev/md1 --fail /dev/sda2
mdadm --manage --stop /dev/md0
mdadm --manage --stop /dev/md1

cat /proc/mdstat will show nothing as we dont now have md drives

Now lets rebuild against B drive (the old data we want to restore)

mdadm --assemble /dev/md0 /dev/sdb1
mdadm --assemble /dev/md1 /dev/sdb2
mdadm --manage --run /dev/md0
mdadm --manage --run /dev/md1

Now cat /proc/mdstat shows the drive built with sdb

Mount and check that it is the old, non upgraded system:

mount /dev/md1 /mnt/temp
ls /mnt/temp
DOESNT have the UPGRADE file created earlier so we are back before the upgrade

we can also see with mdadm --detail /dev/md1

Now we need to blank off the A DISK otherwise it seems to automatically get added back into array on reboot, and appears to take presidence again.

mdadm --zero-superblock /dev/sda1
mdadm --zero-superblock /dev/sda2

Now reboot into system as normal

ls /
will show that we still dont have an UPGRADE file so we are on the old system as desired

cat /proc/mdstat will show that we are still using sdb only for the arrays

So we can now add the A drives back in:
mdadm --manage /dev/md0 --add /dev/sda1
mdadm --manage /dev/md1 --add /dev/sda2
Which will do a full rebuild of A drives (check progress with watch cat /proc/mdstat)

Do we now need to redo grub installation? I'm not sure but probably should to be safe
grub install etc etc

Now one final reboot to ensure we are all done.
Reply With Quote