Main Menu

Create Exact Disk Images in Ubuntu PDF Print E-mail

To create an exact disk image of one drive to a flat file, the most efficient (and scriptable) way is to use the dd command. From my experience, the block size doesn't matter much, but I'd recommend using either 32768 or 1M as noted in examples below:


sudo dd bs=32768 if=/dev/sdb of=~/Desktop/Ubuntu_Backup


or


sudo dd bs=1M if=/dev/sdb of=~/Desktop/Ubuntu_Backup


This can take some time depending on the size of your drive. If you choose a smaller block size, it will take significantly longer to copy the entire drive. Go make a pizza while it's copying.


To restore from your backup, just flip the 'if' and 'of' values:


sudo dd bs=32768 if=~/Desktop/Ubuntu_Backup of=/dev/sdb


or


sudo dd bs=1M if=~/Desktop/Ubuntu_Backup of=/dev/sdb


Make sure you double-check that you have the correct destination drive to avoid overwriting your data. My USB keychain drive comes up as /dev/sdb.


After you restore your backup, make sure you install the bootloader.