Merge two hard drives into a single third drive

Q I have a Linux box running SUSE 9.3 Pro. It was installed with three hard disks in the following configuration, which was taken from fstab:

/dev/hda3           /     reiserfs acl,user_xattr        11
/dev/hda1           /boot ext2       acl,user_xattr      12
/dev/hdb3           /home reiserfs acl,user_xattr        12
/dev/hdb4           /tmp  reiserfs acl,user_xattr        12
/dev/hdb1           /usr  ext2       acl,user_xattr      12
/dev/hdb2           /var  reiserfs acl,user_xattr        12
/dev/hda2           swap  swap        pri=42             00
/dev/hdd1           /shares reiserfs acl,user_xattr        12

hda is 40GB, hdb is 15GB and hdd is 4GB. I have now decided that, as I want to have a CD-writer and a DVD reader installed, it would be better to combine hdb and hdd on to a new 40GB hard drive that I have purchased especially. What I want to know is how I should go about installing, copying and configuring the new disk so that all the data on the existing partitions is copied correctly to new partitions on the new disk.

A This should be a straightforward process. I would install the new hard drive, along with the three existing ones. Boot Linux in single user mode. This is done by either adding single to the kernel parameter line in your lilo.conf or grub.conf, typing linux single on the LILO boot prompt. Or press E on the Grub splash screen, add single after the line starting with kernel, press Enter to save and press B to boot. Then partition your new hard drive to your heart's desire, using fdisk or parted. Format the partitions with the filesystem of your choosing. Mount them manually and copy the files from the old partitions to the new ones - I would use the -a flag with cp:

# cp -a /old-partition-mountpoint/* /new-partition-mountpoint


# tar cp /old-partition-mountpoint/* |tar x -C/new-partition-mountpoint/

Then it's down to modifying /etc/ fstab to point to the new locations and you're set!

Follow us on or Twitter

Username:   Password: