7

I have spent a lot of time to configure my laptop (128 GB SSD, 60 GB used), because I installed MATLAB, LaTeX, Mathematica and some simulation software. I don't want repeat configure/install these things on another laptop, if I could copy the entire SSD to another laptop's SSD.

I found older threads How to copy my Ubuntu system (laptop) to another laptop ? but they recommend CloneZilla, it has limits for system package size (not more than 4GB), maybe there is a better solution?

2
  • 3
    something like this? sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /destination/path ostechnix.com/backup-entire-linux-system-using-rsync
    – kenn
    Jun 30, 2018 at 8:46
  • @kenn, yes , i want copy entire system to a new device, so that i can avoid repeat install/configure software in new computer.
    – lumw
    Jun 30, 2018 at 11:48

2 Answers 2

2

CloneZilla works perfectly.
It produces small image files, has integrity check and works fast.

If you want to use third device as image repository you should choose device-image when creating image of the first disk and then image-device when you restore it to second disk.

If you want to use only two disks - you should use device-device mode.

Optionally you may want generate new UUIDs, SSH-key (if SSH server installed), and change hostname.

2
  • 1
    recently, i find a tool named "TimeShift", i think i can use this tools creat Snapshot, and then restore in other laptop to realize system migrations.
    – lumw
    Jul 6, 2018 at 3:58
  • You can write more about TimeShift (on success, as an answer), it would be very useful.
    – N0rbert
    Jul 6, 2018 at 19:44
0

I'm sure there are lots of ways, so expect others to have quite different answers.

For this sort of thing, it helps a lot if you have a drive dock: a USB device that can hold your extra SSD outside your laptop. I will concentrate on such an arrangement. I will also assume you're comfortable with doing things from the command line. I will mostly use software that is installed by default.

I would run off of installation media, like the DVD containing your version of Ubuntu, and choose "try Ubuntu" so you are not running from the drive you're going to be copying. Bring up a terminal (click the desktop and type Ctrl-AltT). Become the superuser (sudo -i and use your user password).

the command df -h will give you a human-readable list of the partitions you have. You'll probably find everything on your SSD is listed as /dev/sda<something>. So /dev/sda will be the source for everything you want to copy.

You can

ls -l /dev/sd*

to show the hard drives and their partitions. You should see just things under /dev/sda.

Now put the target SSD in the drive dock and spin it up.

Now, try this again:

ls -l /dev/sd*

and I would expect to see at least /dev/sdb, and perhaps some numbered partitions. If so all is well, except you should convince yourself that you really want to destroy all those /dev/sdb partitions. If you only have /dev/sdb itself, there are no partitions.

Now, if the two SSD drives are the same size, it gets very easy. Just copy the entire drive. My usual technique is

dd if=/dev/sda of=/dev/sdb bs=102400

if= names the source ("input file") and of= names the destination ("output file"). DO NOT GET THESE BACKWARDS!!!

bs= gives a block size, which here is about 100K. The default would be just 512 bytes and would be VERY slow. You want it to be a multiple of 1024 at the very least. Because of the zeroes, this is a multiple of 4096.

The results will work, but it's a little bit weird because the UUIDs of all of the partitions are also copied. What's weird about it is that "UUID" stands for Universally Unique ID, and they are no longer unique. This can be fixed, but it's probably best for that to be in a separate question. Until it has been fixed, do not attempt to use the two drives in the same machine for anything at all because the kernel will likely get confused about which partition is which. Take the copy out of the dock as soon as the copy has finished.

If the destination drive is larger than the one in your laptop and the laptop drive has an old MSDOS partition table, you can still use this technique, but there will be some unallocated space at the end of the drive.

In all other cases, you may have to do some resizing of partitions, and copy them individually. This also may be best in a different question.

If you're going to ask another question, I suggest you mention some additional information:

  1. what are the drive sizes? You said the existing one was 60 GB, but its label probably also lists the number of LBAs which gives more detail.
  2. what type is the existing partition table? It's almost surely either MSDOS or GPT. You can find out from gparted, among other tools.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .