Introduction
If your disk drive is acting a little funky, or if the thing it’s on has only a leg left to stand on, it is very easy to duplicate your install to another drive of equal or greater size without the use of utilities such as CloneZilla (which is still useful to have on-hand, but not entirely necessary for this).
This doesn’t assume special circumstances. For automatically-mounted partitions defined in /etc/fstab
, making all partitions not directly a part of your Ubuntu MATE installation (/
, ~
etc) mount by label will smooth out this process and remove some steps excluded from this tutorial.
Remember: gParted will not clone mounted partitions! This must be done in a live session; if you’ve previously installed Ubuntu MATE, then you will need to boot into that, else make an installer.
Seriously, do it. There are also more-than-enough guides on how to make a usable USB installer so I will not cover that detail.
Duplicating your installation
Copying with gParted
From the live session you (probably) used to install Ubuntu MATE on, you’ll need to do sudo gparted
(though, gksu
can be used in lieu of sudo
, it really doesn’t matter.)
Preparing your destination device
If there are partitions already there, just unmount all active partitions in caja
and delete all your partitions. If you’re seriously paranoid about existing data being found, you can use caja
to unmount partitions on your destination device, then go into terminal to type the following command;
dd if=/dev/urandom of=/dev/sdX bs=1M
(sdX
being whatever your destination drive; Example: sdc
)
If using dd
to overwrite the destination drive with garbage data, you will need to select Device from the menu bar in gparted
and choose Create partition table, selecting whatever table was used for your target drive at the dialog box which will open. Most users don’t need to touch this since it defaults to what most users select, being msdos
Doing the dupe
After selecting to refresh devices (if you had used dd
as stated above), or after opening gParted had it not been open already, select your target device (where your Ubuntu MATE installation is) using the drop-down menu in the upper-right and right-click on a partition in the graph; Choose to copy, then switch to your destination device and paste. A little tedious, but far less tedious than using parted
from command-line.
Special note about extended partitions; Make those first, from order of left to right as necessary to reflect the configuration of the target device. That may require you to perform some maths to find the total size of the drives in each extended partition, so you can make each extended partition the same size, sans non-contained partitions to the right.
After all operations had finished, you’re done copying. Easy enough, but it now has to function…
Making it work
This is the easiest step; do grub-install /dev/sdX
and let that do its thing. That will install GRUB, and since your GRUB configuration is already on the drive, it’ll be made usable when you boot into the destination drive.
(Again, sdX
being whatever your destination drive; Example: sdc
)
Whatever you do with the target drive after confirming the destination drive will boot into your system is entirely up to you; You can delete all of its partitions, use it with other things for loading different systems and using different software on other devices, or archive data you rarely access should it still be perfectly functional, but near-death until you can buy another new drive to transfer that data onto. The sky is your limit.
Problems with grub-install
A quick addendum; If you end up having problems with grub-install
because of some weird error message, the easiest way to resolve it is to boot into your old media device with Ubuntu MATE still on it and use grub-install
there. After you’ve confirmed the new media works, then you can dd
the old media and use it for something else.