4 Ways To Clone An Entire Hard Drive On Linux
4 Ways To Clone An Entire Hard Drive On Linux
com
8-10 minutos
Luckily, this is possible and much easier than you may think. There
are many different available Linux programs that will help you back
up your hard drive, including one that is already installed by default
in every Linux distribution.
Best of all, these tools will allow you to save the contents of your
hard drive to an image file, giving you more flexibility with your
backup is stored.
Many modern backup tools will save the contents of your hard drive
to the cloud or clone your hard drive to another hard drive. While
these are both useful and completely valid options, they aren’t very
flexible.
If you decide you don’t want your data saved in the specific cloud
server you chose, then you have to jump through hoops to switch to
a new one. Or if you cloned your hard drive to a second one, then
you would need to repeat the process over and over again anytime
you wanted to move the backup to a different storage.
1 de 8
An image file is, as the name implies, is a single file that contains
your entire backup. This means you can treat it the same as any
other file, whether you want to move, copy or delete it, etc. This
allows you to easily move your backup to other storage media or
even make multiple copies so that even your backup has backups.
1. GNOME Disks
To convert your hard drive to a disk image, have the drive selected,
go into the drive options menu (often looks like a button with three
dots), and select “Create Disk Image … “
From there, simply choose where you want the image file saved
2 de 8
and click on “Start Creating … “
2. Partimage
Because Partimage will only copy data from the used portions of a
partition, it processes much faster than other backup software that
will copy the entire partition, including empty space.
Likewise, it also restores backups from image files much faster than
many alternatives.
3 de 8
Once you’ve selected the partition you want to clone, follow the
instructions shown in the menu, then press F5 to go to the next
section.
It will let you choose your compression level, such as splitting the
image into multiple files.
When you hit F5 again to continue, it will ask you to confirm the
options you set, then start the cloning process.
3. CloneZilla
Unlike the rest of the tools in this list, Clonezilla isn’t one you install
on your computer. Instead, it runs off of a USB drive and lets you
boot into it to clone your hard drive.
For anyone with experience creating Linux Live USBs, this will be
very familiar, as the process is essentially identical.
4 de 8
Go to the Clonezilla official website and download an ISO. Any of
them will work, but stable or alternative stable will be your best bets.
From there, you will need to burn it to a USB drive, then reboot your
computer, making sure to boot into the Live USB you just created.
After you’ve booted into the Clonezilla Live USB, the instructions
are pretty straightforward. Choose the “device-image” mode to
clone your hard drive, then continue selecting where you want your
new image file saved and follow the rest of the instructions.
5 de 8
When it asks if you want to run beginner or expert mode, choose
the beginner mode to make things simpler for now.
The rest of the menus should be easy to understand, but if you get
lost, follow along with this simple Clonezilla tutorial.
4. dd
Although there are quite a few useful options with the lsblk
command, we really only need the default for this scenario. Open a
terminal and enter the following:
6 de 8
When you run lsblk, you should see one or more drives with their
partitions nestled underneath them. Use this information to
determine which drive you want to clone. We are using “sda” as an
example.
Of course, you can change the destination of the image file. Once
the process finishes, you can move the image file or make copies of
it.
When you decide to restore the backup to your hard drive, the
process is just as simple as creating the backup.
7 de 8
sudo dd if=/path/to/backup.img of=/dev/sda
Again, make sure to specify the name of the hard drive you want to
restore the backup to.
In most cases, you’re not likely to get your data back. However, you
can use PhotoRec to recover files that have not been overwritten.
cp /path/to/backup.img backup-copy.img
This will create a copy in your current directory, but you can also
specify a different directory to save it in if you prefer.
You can also create a copy using a file browser like you would with
any other file. Just right-click on it, select “Copy” then paste it.
Wrapping Up
You should now have a good idea of the benefits of cloning your
entire hard drive to a disk image and some of the ways to do it on
Linux. But if you decide that you would rather use a cloud-based
backup service instead, follow this guide on using CloudBerry to
back up your Linux desktop.
8 de 8