Transfer Mepis from secondary drive onto primary drive

Q I have a two-disk box with the hda holding Windows 98 SE, and SUSE 10.1 and Mepis 6.0 on hdb. I have decided to switch my main distro to Mepis. Everything is now installed on it and I want to ditch SUSE. However, I would really like to transfer Mepis 6.0 on to the primary drive. I am currently booting through SUSE's Grub, installed in the boot section of hda MBR, so as soon as I delete SUSE I will lose the ability to boot (but could solve this with the Live CD option). Is there an easy way, such as a total disk transfer, to copy Mepis as configured over to hda? I need to keep Win98, unfortunately.

A Grub is installed in the MBR, so it won't be deleted when you delete SUSE. You will lose the /boot/grub directory, which contains files needed by Grub, but you can replace that with the same from Mepis. The whole process is best done from a Live CD - you don't want to be messing with filesystems that the OS could be changing while you are copying them. Boot from the Mepis Live CD and log in as root, with password 'root' Assuming that SUSE is on /dev/hda2 and Mepis on /dev/hdb1, do the following:

mount /dev/hda2
mount /dev/hdb1
cp -a /mnt/hda2/boot /mnt/hdb1/boot.suse

This mounts the filesystems and creates a backup copy of the SUSE boot directory, just in case you need it later. Now you can reformat the SUSE partition. You have a choice of filesystems to use here but if you are unsure use

mke2fs -j /dev/hda2

to create an ext3 filesystem. Now copy everything across with

rsync -ax /mnt/hdb1/ /mnt/hda2/

The trailing slashes are important! This process may take a while. When it has finished you need to edit /mnt/hda2/etc/fstab and change all the hdb references to suit the new locations on hda. You can reuse the SUSE swap partition on /dev/hda. The last step is to ensure your system boots correctly. If there was a /boot/grub directory on your Mepis disk, you need to edit the configuration file in /mnt/hda2/boot/grub/menu.lst to suit the new locations. Grub numbers disks and partitions from zero, so /dev/hda2 is (hd0,1) in Grubspeak. You may also need to add a menu entry to boot Windows, which you can copy from /mnt/hda2/boot.suse/grub/menu.lst. If there was no grub directory on your Mepis installation and you were handling everything from SUSE's bootloader, copy the grub directory from boot. suse into boot and edit menu.lst to add a suitable entry such as

title MEPIS at hda2, kernel 2.6.15-26-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.15-26-386 root=/dev/hda2 nomce quiet vga=791

The name of the kernel file should match whatever is in your boot directory. Finally, run Grub to make sure you are using the correct configuration:

grub
root (hd0,1)
setup (hd0)
quit

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar