8

I got a new HDD and want to move an existing Linux installation (more specific: OpenSUSE 11.1) from a partition on the old HDD to a partition on the new HDD.

My plan is:

  1. boot using a boot CD (let's say it's the OpenSUSE boot CD)

    EDIT As suggested by many people (thanks to all)
    1a. copy all of the files from one drive to the other

  2. modify /etc/fstab (add mount points to new partitions)
  3. modify /boot/grub/menu.conf (add boot partition)
  4. reinstall grub

Am I right? Is that's it?
Or did I mis some important step? (I'm pretty sure I did)

3 Answers3

4

I would say there is one thing you missed.

  1. boot using a boot CD (let's say it's the OpenSUSE boot CD)

    1a. copy all of the files from one drive to the other

  2. modify /etc/fstab (change mount points to new partitions)

  3. modify /boot/grub/menu.conf (change boot partition)
  4. reinstall grub

I would say if you set up the partition on the new drive to be compatible with the old setings, this should be pretty straightforward. It might be a little more complicated if you have to edit the mount point locations inside of the OS files. I would recommend keeping the partitions similar enough that all you must do is boot, mount the new drive, copy, change boot partition, re-install grub on new drive. remove old drive and you are done!

Axxmasterr
  • 7,966
1

You need to copy files as Axxmasterr pointed out. Everything else looks right to me. Others have followed a very similar path: Moving a GNU/Linux installation to a new partition

Be careful with the cp command you use to copy files over. Use the -a option to ensure correct behaviour when you hit symlinks and preserve ownership information.

Some folks have used tar instead of cp to copy the files over to the new partition:

$ cd sourcedir; tar --create --file=- . | (cd targetdir; tar --extract --file=-)

As suggested in the link at the start, you may want to leave the old entry in the grub file and just add a new one, in case you need to revert.

Good luck!

1

I think that will work.

If there's just the one partition on each hard drive, and the new disk is the same size or larger than the original disk, then a faster way is to just clone the old one (/dev/xxx, where xxx = your original disk sda, hdb, etc.) to the new one (/dev/yyy).

So the steps would be:

  1. Boot using a live cd
  2. sudo dd if=/dev/xxx of=/dev/yyy bs=32k

Make sure you get if (input file) and of correct, or you will clobber your entire old disk.