Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mount a gzip image
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
calvinrsmith
n00b
n00b


Joined: 12 Mar 2005
Posts: 23

PostPosted: Sat Mar 12, 2005 8:50 pm    Post subject: mount a gzip image Reply with quote

i have a filesystem in a file that works find when mounted loopback
now i'd like to gzip the image and mount it readonly without having to ungzip it first.
how do I do this?
Back to top
View user's profile Send private message
Perennial
n00b
n00b


Joined: 07 Mar 2005
Posts: 56
Location: Center of Europe

PostPosted: Sat Mar 12, 2005 9:52 pm    Post subject: Reply with quote

If you want a compressed read-only filesystem in one file, I'd suggest you try squashfs instead.
_________________
Mystery creates wonder and wonder is the basis of man's desire to understand. -- Neil Armstrong
Back to top
View user's profile Send private message
yottabit
Guru
Guru


Joined: 11 Nov 2002
Posts: 313
Location: Columbus, Ohio, US

PostPosted: Sun Mar 13, 2005 12:53 am    Post subject: Reply with quote

Pros/cons of squashfs v. gzip v. bzip2?
_________________
Play The Hitchhiker's Guide to the Galaxy!
Back to top
View user's profile Send private message
calvinrsmith
n00b
n00b


Joined: 12 Mar 2005
Posts: 23

PostPosted: Sun Mar 13, 2005 6:11 am    Post subject: Reply with quote

Perennial,

Let me explain what i'm doing.
I have drives and for a complete backup I just dd the drive. This makes for easy restore since I can just dd the image back to a new drive :) also they tend to gzip down quite nice so I gzip the images. Now once in a while I need a file from the backup (ie the drive image) and so I have to ungzip the image (now i have two copies of the image) then loopback mount it and finally when I'm done I have to delete the uncompressed image.
Some of the drive images are linux (ext2/3, reiserfs), some are cd's (iso) whereas others are windows (fat/vfat/fat32,ntfs), some are bootable others are not, some are simple partions others are entire drives. having to tar, cpio or other such stuff tends to screw things up and make for a more difficult restore
It would be nice to be able mount the gziped imaged, grab what i need, unmount it and be done with it
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sun Mar 13, 2005 6:20 am    Post subject: Reply with quote

Instead of gzipping, you could make a squashfs filesystem using the dd image file, and mount from there.
Back to top
View user's profile Send private message
Perennial
n00b
n00b


Joined: 07 Mar 2005
Posts: 56
Location: Center of Europe

PostPosted: Sun Mar 13, 2005 9:08 am    Post subject: Reply with quote

yottabit wrote:
Pros/cons of squashfs v. gzip v. bzip2?

squashfs is a filesystem, it is not a simple compression utility. SO you can't really compare them

If you want to compare squashfs to dd+gzip/bzip,
I'd say squashfs:
PRO:
- designed as a space-efficient filesystem: it even restricts then number of inodes it needs to the absolute minimum, this is obviously just better compressing all blocks.
-ease of use:
generation with 1 command: mksquashfs
simple to mount: mount -t squashfs
CON:
- you'd need kernel support

As for dd with gzip, you could argue that it isn't difficult at all either to generate and that it uses standard tools, but there is no easy way to mount it AFAIK.
And when it comes to compression of filesystems, I think squashfs is better performing (smaller) as it doesn't store unused sectors.
_________________
Mystery creates wonder and wonder is the basis of man's desire to understand. -- Neil Armstrong


Last edited by Perennial on Sun Mar 13, 2005 9:41 am; edited 2 times in total
Back to top
View user's profile Send private message
Perennial
n00b
n00b


Joined: 07 Mar 2005
Posts: 56
Location: Center of Europe

PostPosted: Sun Mar 13, 2005 9:38 am    Post subject: Reply with quote

calvinrsmith wrote:

I have drives and for a complete backup I just dd the drive. This makes for easy restore since I can just dd the image back to a new drive :) also they tend to gzip down quite nice so I gzip the images. Now once in a while I need a file from the backup (ie the drive image) and so I have to ungzip the image (now i have two copies of the image) then loopback mount it and finally when I'm done I have to delete the uncompressed image.

I now see your objection to squashfs. Squashfs is excellent for archiving, but not if you want to use it as a system backup tool of course.
For that purpose there are others. I now use rdiff-backup for backup, but I don't know if this would work fine with windows filesystems.
Back in the time when I still had windows laying around, I used something called 'savepart', but this was pre-XP era, so still FAT :) ....You can find savepart here. Beware this is a DOS tool! But it allows access to ntfs as well by now I see, and it only saves the used sectors, a bit like squashfs.
There is now also a linux alternative, namely partimage.

BTW there are cons to using dd for a backup too...you'd need same sized partition to restore to... If you ever need to replace your HD after a crash by a bigger one, this may be an issue.

calvinrsmith wrote:

It would be nice to be able mount the gziped imaged, grab what i need, unmount it and be done with it

I agree, but I currently don't know of a way to do this easily.
_________________
Mystery creates wonder and wonder is the basis of man's desire to understand. -- Neil Armstrong
Back to top
View user's profile Send private message
Joshua5526
n00b
n00b


Joined: 02 Jan 2013
Posts: 1

PostPosted: Wed Jan 02, 2013 8:43 pm    Post subject: Reply with quote

Am looking for this solution as well. It looks like this link gives a possible answer. Haven't tried it myself.
http://blogs.gnome.org/muelli/2012/10/loopback-monting-huge-gzipped-file/
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31705
Location: 56N 3W

PostPosted: Wed Jan 02, 2013 8:56 pm    Post subject: Reply with quote

calvinrsmith,

Why do you use dd and not tar for backups?
dd makes an image of the entire drive, free pace included. tar will just save the files on the filesystem. You may compress the tar file 'on the fly' if you wish.
tar allows the recovery of single files, even from compressed tarballs.

The only advantage of dd over tar, is that dd can save the content of the disk space before the first partition too. If thats important to you, you can dd that separately to a compressed tarball of the filesystem.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 3998

PostPosted: Wed Jan 02, 2013 10:26 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Why do you use dd and not tar for backups?

It is probably better to use mksquash than tar+gzip for backups: The time and compression ratio is about the same, but as mentioned it is not a problem with linux kernels to mount it and thus to access or extract single files. And if you have a kernel which cannot access is, you can still unsquash it, so no disadvantage compared to tar+gzip (unless you need to unpack on a windows system - I do not know whether an unsquash exists for windows).

Joshua5526 wrote:
It looks like this link gives a possible answer.

I think this is a false information: avfs can make a tar+gz "appear" as unpacked, but this cannot work "on the fly" due to the tar+gz format - avfs must unpack at every single access or keep a huge cache. (IIRC avfs uses a clever mixture of both, but access is slow anyway for huge files and needs a lot of local disk space.)
Back to top
View user's profile Send private message
s4e8
Apprentice
Apprentice


Joined: 29 Jul 2006
Posts: 205

PostPosted: Sat Jan 05, 2013 2:10 am    Post subject: Reply with quote

Yes. mksquashfs is the best. It exclude free spaces and do de-duplicate, and has multithread compressor.
Back to top
View user's profile Send private message
natenjo
n00b
n00b


Joined: 23 Jun 2013
Posts: 1

PostPosted: Sun Jun 23, 2013 8:40 pm    Post subject: Reply with quote

Hello
I successfully managed it with AVFS

cd /root/.avfs/path/to/folder/where/dd/is/located
losetup /dev/loop5 image-mit-gzip.dd.gz#
mkdir /mnt/wo/die/image/eingehangen/werden/soll
mount /dev/loop5 /mnt/where/it/sould/be/mouted

(via http://blog.dreessen.it/?p=112)

Works very well for me!
Back to top
View user's profile Send private message
augury
l33t
l33t


Joined: 22 May 2004
Posts: 718
Location: philadelphia

PostPosted: Tue Jun 25, 2013 8:14 am    Post subject: Reply with quote

I don't know that gzip retains the filesystem formalities required for a clean contigous stream which could be dealt with as a successful mount.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum