Whether youâre setting up multiple computers or doing a full backup, cloning hard drives is a common maintenance task. Donât bother burning a new boot CD or paying for new software â you can do it easily with your Ubuntu Live CD.
Not only can you do this with your Ubuntu Live CD, you can do it right out of the box â no additional software needed! The program weâll use is called dd, and itâs included with pretty much all Linux distributions. dd is a utility used to do low-level copying â rather than working with files, it works directly on the raw data on a storage device.
Note: dd gets a bad rap, because like many other Linux utilities, if misused it can be very destructive. If youâre not sure what youâre doing, you can easily wipe out an entire hard drive, in an unrecoverable way.
Of course, the flip side of that is that dd is extremely powerful, and can do very complex tasks with little user effort. If youâre careful, and follow these instructions closely, you can clone your hard drive with one command.
Weâre going to take a small hard drive that weâve been using and copy it to a new hard drive, which hasnât been formatted yet.
To make sure that weâre working with the right drives, weâll open up a terminal (Applications > Accessories > Terminal) and enter in the following command
sudo fdisk âl
We have two small drives, /dev/sda, which has two partitions, and /dev/sdc, which is completely unformatted. We want to copy the data from /dev/sda to /dev/sdc.
Note: while you can copy a smaller drive to a larger one, you canât copy a larger drive to a smaller one with the method described below.
Now the fun part: using dd. The invocation weâll use is:
sudo dd if=/dev/sda of=/dev/sdc
In this case, weâre telling dd that the input file (âifâ) is /dev/sda, and the output file (âofâ) is /dev/sdc. If your drives are quite large, this can take some time, but in our case it took just less than a minute.
If we do sudo fdisk âl again, we can see that, despite not formatting /dev/sdc at all, it now has the same partitions as /dev/sda.
Additionally, if we mount all of the partitions, we can see that all of the data on /dev/sdc is now the same as on /dev/sda.
Note: you may have to restart your computer to be able to mount the newly cloned drive.
And thatâs itâŠIf you exercise caution and make sure that youâre using the right drives as the input file and output file, dd isnât anything to be scared of. Unlike other utilities, dd copies absolutely everything from one drive to another â that means that you can even recover files deleted from the original drive in the clone!
- › The 10 Cleverest Ways to Use Linux to Fix Your Windows PC
- › Transfer a Drive Image Over a Network Using an Ubuntu Live CD
- › How to Install the Transmission BiTorrent Client on Your Router (DD-WRT)
- › Ask How-To Geek: Clone a Disk, Resize Static Windows, and Create System Function Shortcuts
- › Make a Drive Image Using an Ubuntu Live CD
- › AMD’s Ryzen 7000 Series Are the First 5nm Desktop CPUs Ever
- › The Origins of Ctrl+C, Ctrl+V, Ctrl+X, and Ctrl+Z Explained
- › What’s New in Chrome 102, Available Now