Copy ubuntu from one PC to another

6,764

There are different ways to do this. If all you have is usb keys here's what you can do:

You need 2 usb keys. If you have 3 it'll be easier though:

  • one for clonezilla
  • one for ubuntu live
  • one for transferring data

If there's any data you can't afford to lose, backup first.

If your hd is not already like this use gparted to resize/repartition it:

  • Windows partition (say 30Gb),
  • Linux partition (10Gb),
  • Big empty ext3 partition filling up the rest of the disk (500-30-10=460Gb).

Prepare your windows installation to be moved to a new computer.
For windows 7 follow this sysprep tutorial (method two, "using third party imaging software")

Now we can use Clonezilla to create images of the windows and linux partitions inside the 3rd partition:

  • Boot into Clonezilla, choose device-image mode.
  • Tell it to write to the 3rd partition (3rd partition as /home/partimag)
  • Choose expert mode and saveparts to save images of partitions, not the whole disk.
  • In expert mode options, if you choose no compression it'll be a lot faster but here you might want to compress it since we're putting it on a usb key.
  • Tell it to split images in parts that fit on your usb key.

While it's running use your live ubuntu usb to repartition the other computer likewise.

When clonezilla is finished, copy over the files it created in the 3rd partition to the other computer with your usb key. Do one big file at a time so it fits on your key.


On the other computer:

You can now restore the partitions with clonezilla.

We need to install grub so the disk boots. Use you ubuntu usb key and follow these instructions (look for "Fixing a broken system").

Fix /etc/fstab: put the right UUID for your linux partition (find out with blkid /dev/sda2 if linux is on /dev/sda2)

Linux should boot now. Try rebooting from hard drive.

For the windows part finish the tutorial.


Notes:

  • Clonezilla is smart, if only 3Gb of a 10Gb partition are used, the image will be 3Gb (or less).
  • As you can see it's easier to reinstall from scratch, but if you really need to transfer an existing installation it can be done.
  • By any means get an external usb hard drive if you can. It'll be a lot easier / faster to transfer files.

Good luck !

Share:
6,764

Related videos on Youtube

PHPLove
Author by

PHPLove

Updated on September 18, 2022

Comments

  • PHPLove
    PHPLove over 1 year

    I have a very weird scenerio here, I have installed some softwares on my Ubuntu machine, Now I want to move everything (including windows)to another Machine B, notice Machine has no access to Internet at all..

    So apt-get install cancelled here. I have created the bootable USB for ubuntu, but can I create the bootable USB including all the files of machine A? so I can install easily on machine B

    Here is what I have already done

    • used CloneZilla, but it creates clone of whole HDD, so if my HDD is 500 Gb it asks for 500 GB usb,
    • cant use apt-get install on Machine B
    • Cant use rsync even

    in current scenerio is there any way/tool that allows me to create bootable USB of my running window, so I can move my whole ubuntu plus files to Machine B. thanks

  • PHPLove
    PHPLove over 9 years
    thats not possible since I cant change the HDD at all