Migrating a Raid 1 to bigger harddisks on SME using Knoppix here.

Migrating a Raid 1 to bigger harddisks on SME using Knoppix


Author: Lloyd Keen, David Biczo
Sources:
Tested on SME Version 6.0.1-01 GPL, 6.0B3
Created: 04.04.05 Updated:
License: GPL


Replacing a Damaged Scsi Software Raid 1 With a Larger Ide Raid 1 on SME

Note: To get the best performance from raided ide drives they should be set as masters on the primary and secondary channels. ie. hda and hdc

Step-1 - boot knoppix from CD and image good scsi drive to new ide drives

Pull up terminal as root

$ su

Image drives, where sdx is the remaining good drive either sda or sdb

# dd if=/dev/sdx of=/dev/hda
# dd if=/dev/sdx of=/dev/hdc

This step take quite some time (in the order of hours) so be patient

Step-2 - move and resize partitions to use larger hard drive space

Reboot knoppix with no swap device

# knoppix noswap

Pull up terminal as root

$ su

Use graphical interface to move swap partition to end of the drives

# qtparted

select hda right click on the swap partition and select move type 0 in the "Free space after" box and press tab. click OK click Device and select commit

repeat for hdc

Resize root partition to take up remaining free space (qtparted doesn't support ext3 so must use parted)

# parted /dev/hda

(parted) print

write down the size of the starting positions of the root (Minor 2) and swap (Minor 3) partitions and call them r & s (parted) resize 2 r s (parted) quit

repeat for hdc

Step-3 - edit raidtab file and copy to knoppix file system

Mount root partition of new ide drive right click hda2 icon on desktop click mount right click hda2 icon again click Actions, Change read write mode click ok to change to write

# mcedit /mnt/hda2/etc/raidtab

Change all sda to hda and all sdb to hdc and save

Now copy the raidtab file from your real root filesystem to the current root filesystem.

# cp /mnt/hda2/etc/raidtab /etc/raidtab

Step-4 - unmount filesystems

In order to start the raid devices, and sync the drives, it is necessary to unmount all the temporary filesystems.

# umount /mnt/hd*

Step-5 - start raid devices

Because there are filesystems on /dev/hda1, /dev/hda2 and /dev/hda3 it is necessary to force the start of the raid device.

# mkraid --really-force /dev/md2

You can check the completion progress by cat'ing the /proc/mdstat file. It shows you status of the raid device and percentage left to sync. Again this step can take quite some time (in the order of hours) so be patient.

Continue with / and /boot

# mkraid --really-force /dev/md1
# mkraid --really-force /dev/md0

The md driver syncs one device at a time.

Step-6 - resize filesystem

When we created the raid device, the physical partion became slightly smaller because a second superblock is stored at the end of the partition. If you reboot the system now, the reboot will fail with an error indicating the superblock is corrupt.

Resize them prior to the reboot

You will be required to fsck each of the md devices except the swap device. The -f flag is required to force fsck to check a clean filesystem. This will generate the same error about inconsistent sizes and possibly corrupted superblock. Say N to 'Abort?'.

# e2fsck -f /dev/md0
# e2fsck -f /dev/md1

# resize2fs /dev/md0
# resize2fs /dev/md1

Check again to be sure. Should be no errors now.

# e2fsck -f /dev/md0
# e2fsck -f /dev/md1

Remake swap space

# mkswap -c /dev/md2

Step-7 - Reboot and voila.

# reboot

Back Howto