Linux – Compressed disk image on Linux

archivingcompressiondisk-imagelinux

I just got my new computer with a much bigger harddisk. I think I copied all important files over but just to be sure, I'd like to keep a disk image of my old disk. To save space, I'd like to compress it but I didn't find an option to mount a compressed image.

My goals:

  • Result must be easy to access
  • No need to decompress the whole thing before I can access anything
  • Files should be quick to locate – no TAR/CPIO archive
  • Necessary space should be less than just copying the files over

So ideally, I'm looking for a read-only, compressed file system which I can create in a file and which grows automatically.

Best Answer

Use a forensic analysis software like GUYMAGER (open source, sourceforge.net). It has a nice UI which allows to quickly create a compressed disk image of an entire hard disk.

Use "Advanced forensic image (.aff)" This creates a single, compressed file (well, it also creates an .info file).

To modify the default compression rate 1 (fastest, but least compression). If you have a fast computer with lots of cores, you can change this by creating /etc/guymager/local.cfg:

AffCompression = 3

9 is the best but slowest compression. 3 gives a good compression with good performance.

Update

Mounting isn't as simple as it seems. First of all, you need AFFLIB (Ubuntu: aptitude install afflib-tools). Now you can get the raw disk image with [affuse][3] <image> <mount-point>

But for some reason, mounting the raw image fails. parted says the first partition starts with 1048576B but

mount -t ext4 -o loop,ro,offset=1048576 /mnt/backup.raw /mnt/backup

fails with the usual useless mount error:

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
   missing codepage or helper program, or other error
   In some cases useful info is found in syslog - try
   dmesg | tail  or so

and dmesg says:

EXT4-fs (loop0): VFS: Can't find ext4 filesystem
Related Question