In the built-in "Disks" tool (gnome-disk-utility), I am given the option to back up a partition with the "Create Partition Image..." option.

If I select this, I am prompted for a filename, which has a default extension of .img.

My question is, what format is this in? Is it just a straight block-for-block copy, that I could restore from the command line with something like dd?

I note that I have the ability to restore from .img or .img.xz files (although sadly I don't seem to be able to create the latter), suggesting that .img is probably uncompressed.

  • According to this article, .img is uncompressed: maketecheasier.com/backup-hard-drive-gnome-disk-utility
    – wintermute
    May 7 '16 at 11:31
  • 5
    You are right, it is a sector by sector copy, including bootsector - and sadly unused space. And Yes you can use dd for restoring to an other device - same size or larger, when needed! More interesting is to use it for Virtual machines! May 7 '16 at 11:55

Yes the .img files should be restorable with dd but you can also do it from the disks tool itself if you are less confident with the command line.

To restore using the disk tool , select the partition you want to restore to , click the cog and select 'restore partition image'

If you are unsure about the type of a file you can check it using the 'file' command, this knows how to recognise pretty much any file format.

heres the output from an image i took of a windows restore thumbdrive using gnome disks. We can see that its a whole disk image because

amias@rome:~$ file windows-restore-thumbdrive.img 
windows-restore-thumbdrive.img: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "MSDOS5.0", sectors/cluster 8, reserved sectors 2306, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 2048, sectors 15628288 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 15231, reserved 0x1, serial number 0x1e112916, unlabeled

To restore using dd to the fifth partition of the second disk (/dev/sdb5):

dd if=yourimage.img of=/dev/sdb5

You can only create images of a partition using the disk tool and not an entire disk.

Don't forget to update your boot loader after changing your disks if you want to boot from them. For the vast majority of cases this is done by running :

  • 1
    At least on Ubuntu 18.04, you can create an entire disk image. Just use the "3-line" menu icon on the right side of the title bar (the same menu you use to format the entire disk, benchmark it, etc)
    – MestreLion
    Nov 23 '18 at 3:03
  • Use the command 'file file.img' to find out
    – Amias
    Nov 23 '18 at 7:19
  • 1
    16.04 also has the "Create Disk Image..." in the hamburger menu (aka 3-line menu) Dec 2 '18 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.