4

I have spend many time to configure my laptop(128GB SSD,60GB used). Because i install the matlab, latex, mathematica and some simulation software, so i didn't want repeat configure/install these things to another laptop if i can "Copy" entire SSD to another laptop 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 we have a better solution?

  • 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 '18 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. – Ben Jun 30 '18 at 11:48
1

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.

|improve this answer|||||
  • 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. – Ben Jul 6 '18 at 3:58
  • You can write more about TimeShift (on success, as an answer), it would be very useful. – N0rbert Jul 6 '18 at 19:44
-1

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.
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.