My reason for doing this was to replace the HD in the PC with a larger capacity drive but without having to reinstall and set up the PC again.
Like many users I have configuration files for Bash, Tmux, Vim etc. and also a lot of installed software, and settings. I didn’t want to reinstall everything after installing the OS, in this case Xubuntu.
Here is what you will need
- The PC you want to clone
- An external drive to back-up to
- Replacement drive
- Install media (Live boot USB or similar)
- Timeshift back-up software
Step by step
- Connect the external drive to the PC you want to back up and format it to a filesystem that Linux can use.
Warning: this erases the external drive.
To format the drive install or open gparted.
Format as ext4.
While in gparted take a note of the partition table for the drive you want to replace. Typically on Ubuntu based distros this comprises root(/), home and swap partitions. - Install Timeshift on the PC and create a backup of root ( “/” ) not the user directory.
- Check the backup exists, remove external drive, and replace drive in PC with new drive.
- Boot into live USB or install media. A minimal install of the OS is all that is required, the entire OS will be over-written when the back-up is restored.
During installation when asked about partitioning the new drive, set it up to be the same as the drive being replaced.
Use also the same user and password on the new install as on the drive being replaced, just for continuity. No point in adding to the confusion.
Reasons to do it this way are to install Grub (the bootloader), and if you use XFS in place of EXT4, it’s all set up by the install. - Re-attach the external drive with the backup. Install Timeshift and “Restore from backup”.
Reboot the first time might take a little longer than usual.
This was the easiest way I found to clone a HD to a HD with more capacity without losing any of my data.
All programs, configuration and user permissions are maintained from the backup.