View previous topic :: View next topic |
Author |
Message |
calvinrsmith n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 12 Mar 2005 Posts: 23
|
Posted: Sat Mar 12, 2005 8:50 pm Post subject: mount a gzip image |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Perennial n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/BaldursGate/baldursgate_garrick.gif)
Joined: 07 Mar 2005 Posts: 56 Location: Center of Europe
|
Posted: Sat Mar 12, 2005 9:52 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
yottabit Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/21396843433e4ab1f3e7d52.gif)
Joined: 11 Nov 2002 Posts: 313 Location: Columbus, Ohio, US
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
calvinrsmith n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 12 Mar 2005 Posts: 23
|
Posted: Sun Mar 13, 2005 6:11 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Gherald Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/gallery/BaldursGate/baldursgate2_yoshimo.gif)
Joined: 23 Aug 2004 Posts: 1399 Location: CLUAConsole
|
Posted: Sun Mar 13, 2005 6:20 am Post subject: |
|
|
Instead of gzipping, you could make a squashfs filesystem using the dd image file, and mount from there. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Perennial n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/BaldursGate/baldursgate_garrick.gif)
Joined: 07 Mar 2005 Posts: 56 Location: Center of Europe
|
Posted: Sun Mar 13, 2005 9:08 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Perennial n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/BaldursGate/baldursgate_garrick.gif)
Joined: 07 Mar 2005 Posts: 56 Location: Center of Europe
|
Posted: Sun Mar 13, 2005 9:38 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Joshua5526 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 02 Jan 2013 Posts: 1
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54838 Location: 56N 3W
|
Posted: Wed Jan 02, 2013 8:56 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
mv Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/169262237648b51b40d0ec0.png)
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Wed Jan 02, 2013 10:26 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
s4e8 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 29 Jul 2006 Posts: 311
|
Posted: Sat Jan 05, 2013 2:10 am Post subject: |
|
|
Yes. mksquashfs is the best. It exclude free spaces and do de-duplicate, and has multithread compressor. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
natenjo n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 23 Jun 2013 Posts: 1
|
Posted: Sun Jun 23, 2013 8:40 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
augury l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/114295240844019829c6d3a.jpg)
Joined: 22 May 2004 Posts: 722 Location: philadelphia
|
Posted: Tue Jun 25, 2013 8:14 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|