I'd rather just copy the entire drive, with drive space not being so costly anymore.
I am a proponent of using dd
in these situations whenever possible.
(Though I've gotten away with it mounted and in use, copying the root system should probably be done via a live CD/USB)
(All the device/directory names used below are arbitrary)
Option 1) I would copy the drive to an iso.
dd if=/dev/sda of=/someotherlargedrive/backupname.iso bs=4M status=progress
To restore that image back on a drive.
dd if=/someotherlargedrive/backupname.iso of=/dev/sdb bs=4M status=progress
OR
Option 2) I would copy the ubuntu partition to an iso.
dd if=/dev/sda1 of=/someotherlargedrive/backupname.iso bs=4M status=progress
To restore the image back on a partition
dd if=/someotherlargedrive/backupname.iso of=/dev/sdc1 bs=4M status=progress
!!!Keep in mind that if only cloning a partition, there may be other necessary partitions like "/boot" that may need to be considered depending on the situation.
OR
Option 3) I would copy the entire drive to another drive, creating a usable bootable clone.
dd if=/dev/sda of=/dev/sdb bs=4M status=progress
OR
Option 4) I'd just take the hard drive out of the one PC and put it into the new one... Other than things like graphics and other manually downloaded drivers, the [LINUX] drive should transfer operationally with little to no reconfiguration.
OR
sidebar....Depending on the application and the urgency for portability, I may consider using VMs, as they are easily cloned (or just copied with the cp command)... So the PC itself is basically a file and portable to another host running the virtualization software. I have dd'ed physical boxes into images for VMs(and sometimes directly onto VMs) and have taken copies of my Desktop PC elsewhere around the house and to work & travel on a laptop.
dd
is the command). Boot from a live session, 'dd` your partitions onto an external disk and you can reuse that disk dump to put it on another system. Mind that I would advice to not do this: make a backup of PERSONAL files and just reinstall the system. a bit more work but you can automate all your alterations you want to makecp -a
with no problems.dd
is not so good for this purpose.