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:
- 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.
- what type is the existing partition table? It's almost surely either MSDOS or GPT. You can find out from gparted, among other tools.
sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /destination/path
ostechnix.com/backup-entire-linux-system-using-rsync