0

I am moving my Ubuntu box to a new hardware and for that i must clone the entire harddisk to a new one.

I have read about clonezilla and dd but i am unsure how to use them.

I could also hook up both harddisks to a windows machine and clone there.

What is the best way to do that?

guntbert
  • 13,134
clamp
  • 1,699

2 Answers2

1

To me, the 'best' most version agnostic way to switch an install between system is to dump out the package list on your old system, and copy over configuration files. (and yes, for disclosure's sake, this is identical to my serverfault answer)

use dpkg --get-selections to dump out a list of installed packages, and install them with dpkg --set-selections. Create the same users as the source system if necessary - cat /etc/passwd should list them out, and you can check with diff to see if the two lists are identical.

Then use rsync or some other tool to duplicate your /etc/ folder for settings, various /home/ folders for users (and check permissions here) and other folders like /var/www/. Test, make sure everything's there, and you're done. Takes me less time than to set up a fresh system.

Its currently in limbo, but if you're running an older version of ubuntu, remastersys would have done a good job creating a livecd identical to a running install. Someone else is working on taking over development, and I'll be updating this answer when it is.

Both these options give a good deal more flexibility than imaging

0

Are you sure that you want to clone the entire hard disk since you are switching hardware? (I have never personally tried to clone a hard drive between different hardware, but I imagine there might be problems.)

A better approach might be to do a clean install of ubuntu on your new hardware - that way all your new hardware will be autodetected and properly configured. Let's say your old computer is A, and your new one is B. Once you have clean ubuntu on B, connect both computers to the same network. Then you can use rcp (faster but unencrypted) or scp (encrypted but slower) to copy only your home directory from A to B. The command that you run on B will look something like this:

scp -r <user>@<ip.address.of.A>:/home/<user>/* /home/<user>/

(Note you would have to have sshd running on A to execute this command)

By copying your home directory, you will get all of your Documents and hopefully development stuff copied over. You will also get the application settings from A that are stored in your home folder in dotfiles. You will have to reinstall the software that you had on A, but with a package manager and a relatively fast internet connection, it isn't a big deal. I routinely use this approach for new installations. In fact, now I just have a dedicated hard drive partition for my home directory, and whenever I install a new distro, I simply mount that partition as my home directory. It works pretty well.

Also note that if you do decide to copy the whole drive, clonezilla is very easy to use. You basically make a live CD or USB of it like you would with ubuntu, and then when you boot using that live CD, it just takes you through a guided set of steps to copy the hard drive. I've used it two or three times to make complete backups and it's not tough at all.

Zach
  • 453