How can I copy my (Ubuntu 9.04) Linux filesystem to another computer?

I have spent a lot of time configuring my computer: shell scripts, path definitions, video settings, as well as lots of programs. The disk is ext3 formatted.

I would like to 1) move everything important to a different computer and and/or 2) transfer it all to a virtual machine that could be run in multiple locations, backed up, snapshotted, etc.

I suspect that I could start by just copying the whole directory, but I'd appreciate it if anyone knows a more optimal solution.

Thanks,

David


If you're going to be doing this often, I would suggest making a custom live CD using a tool like remastersys. It's very easy to use and completely portable.


You could back up /usr/local and your home directory into version control and then check out a copy for each system you run it on, this is also convenient when you make changes later.


You can just copy the whole directory across. I used to provision machines like this:

  • boot from rescue CD
  • partition drive
  • copy entire filesystem using rsync-over-ssh (!)
  • rerun grub-install to install bootloader
  • run a script to change hostname and a few other settings
  • reboot into new system

The (!) is because you need to be slightly careful here with the rsync options. -x stops it trying to copy /proc and /sys. Numeric uid and gid is also a good idea. There are some files in /var that may also cause problems.

If you copy to a machine that has different hardware you may need to rebuild the initrd that has all the drivers in it. See your distro documentation for how to do this.


Maybe you can try Clonezilla?