Diary of an ex-GeeXboX developer…

Mount a gunzip'ed image disk from a network share

Posted at — Mar 3, 2013

Some tips about a way to restore a very big gunzip’ed image disk from a network share. I’ve changed of computer and my previous disk was saved in a image with dd and a pipe on gunzip. The image is located on a network share. But I can not restore the whole image because it uses too much spaces. Then, I will mount this one but it was compressed. The solution is mountavfs. You can use this command in order to open compressed files on the fly.

The steps are something like this:

avfsd -o allow_root ~/.avfs

Look at

sudo mount -t nfs ~/mybackup

Just my backup; mount yours as usual…

cd ~/.avfs/home/myuser/mybackup

Here, I will found my image disk file.

sudo mount -o ro,loop,offset=$((63 * 512)) backup.img.gz ~/dst

I mount my file from the ~/.avfs directory (then it will be uncompressed on the fly). I must specify the partition offset because the image is the whole disk with a GPT structure. Look for fdisk, gdisk in order to retrieve the offset. The first seems to be always 63th bloc.

Now you can see the whole content of your gunzip’ed image in the ~/dst directory.