5. I want the fastest possible restore!If speed of recovery and having everything exactly the way it was when you backed up is more important than the space the backup contains
you can backup every drive using dd
to create image file(s). Place the image file(s) on a drive that is large enough to contain everything. Note that you will need enough room to save EVERY sector of the drive(s) you are backing up, not just the space used. You can determine the full size of a drive and its devicename with the terminal command
sudo fdisk -l
or the Disks (Disk Utility) application.
A. Whenever you've done more than you care to do over since the last backup
and / or
B. Prior to upgrading your system to a new version
External USB drive(s) or better: internal/external SATA/SCSI/Fibre Optic drives.
All the commands used here (with the exception of mentioned applications like Disks, Disk Utility and Software & Updates) are entered from the command line via the Terminal. You can open a terminal from the GUI with CtrlAltT
Note: Backing up a mounted drive is never a good idea, so unmount your source drive first. I always accomplish image backups booted from live media so I don't have to worry about this and suggest you do the same. To be safe, double check the output of
mount to make sure that your source drive isn't mounted.
- Connect your backup drive (if not already connected) and mount it if it doesn't auto mount.
- If it is already mounted, find out where it's mounted. The
mount command or the Disks (Disk Utility) application can show you what drives are mounted and the paths they are mounted at. This will be where you store your disk image(s) (likely /media/"USB Volume Name" if you are backing up to an external USB drive)
man mount for more information on 1 & 2)
- Decide whether to use
dd) and follow the set of instructions below that you have chosen.
Backup using dc3dd
You can determine if dc3dd is installed with the command
which dc3dd If installed it will return something like
/usr/bin/dc3dd If you simply get the command prompt back it you can install dc3dd with the command
sudo apt-get install dc3dd Note that this package is in the Universe repository and you will have to enable that repository in "Software & Updates" if it isn't already enabled prior to installation.
dc3dd if=/dev/sdy of=/target/mount/point/sdy.dd.img where sdy=your source drive (in a single drive system this will be sda)
A progress indicator will be provided that reports how much has been backed up and the speed of the process.
When the process is complete as evidenced by the progress indicator reaching 100% and the prompt returning it doesn't hurt to issue the command
sync to ensure that the buffers are flushed to the output file. Now you can unmount (see
man umount and disconnect the drive (if external) and put it some place safe.
Backup using dd
dd if=/dev/sdy of=/target/mount/point/sdy.dd.img where sdy=your source drive
no progress indicator will be shown although you can open another terminal window, find the dd process rapidly with top and issue the command
kill -USR1 xxxx where xxxx is the process number for a one time status report.
You can skip this part unless you are interested ->dd Addendum regarding progress indicator:
In Ubuntu version 16.04 and beyond
dd includes a progress indicator if you use the switch status=progress eliminating the need to use solutions like
pv or the
kill -USR1 approach mentioned above just to obtain progress. An example using the
dd progress indicator is:
dd if=/dev/sdy of=/target/mount/point/sdy.dd.img status=progress where sdy=your source drive (if you try this with a version that is too early to support it you'll just get an error that says
dd: invalid status flag: ‘progress’
When the process is complete as evidenced by the prompt returning it doesn't hurt to issue the command
sync to flush the buffers to the output file. Now you can unmount and disconnect the drive (provided it's external) and put it some place safe.
Simply get your backup drive out of safekeeping, mount it, swap the if= and of= and use the same process.
Restore using dc3dd
dc3dd if=/target/mount/point/sdy.dd.img of=/dev/sdy where sdy=your target drive (in a single drive system this will be sda). When the process is complete as evidenced by the progress indicator reaching 100% and the prompt returning it doesn't hurt to issue the command
sync to flush the buffers to the drive.
Restore using dd
dd if=/target/mount/point/sdy.dd.img of=/dev/sdy where sdy=your target drive (in a single drive system this will be sda). When the process is complete as evidenced by the prompt returning it doesn't hurt to issue the command
syncto flush the buffers to the drive.
Now you can unmount and if you are using an external, disconnect and return the external drive to safekeeping.
Note: sync flushes the filesystem buffers (see
If any part of this answer is unclear, feel free to drop me a comment and I'll do my best to clarify further.
Source: 30+ years of experience