[wplug] filesystems on regular files + compression
Bob Schmertz
rschmertz at speakeasy.net
Fri Jul 25 14:37:24 EDT 2003
Alexandros Papadopoulos incurred the wrath of Bob on Jul 25, by saying
>Hi list!
>
>I hit a snag I need help with.
>
>I'm creating a filesystem on a regular file:
>
>debian-dual:~# dd if=/dev/zero of=virtual_fs count=1 bs=1k
>seek=$[2*1024*1024]
>1+0 records in
>1+0 records out
>1024 bytes transferred in 0.000303 seconds (3378995 bytes/sec)
>debian-dual:~# ls -lhs virtual_fs
> 12K -rw-r--r-- 1 root root 2.1G Jul 25 09:21 virtual_fs
>debian-dual:~# mkfs.ext3 virtual_fs
>mke2fs 1.34-WIP (21-May-2003)
>virtual_fs is not a block special device.
>Proceed anyway? (y,n) y
>Filesystem label=
>OS type: Linux
[snip]
>Writing superblocks and filesystem accounting information: done
>
>This filesystem will be automatically checked every 26 mounts or
>180 days, whichever comes first. Use tune2fs -c or -i to override.
>debian-dual:~# mount -t ext3 -o loop=/dev/loop0 virtual_fs /mnt/loop
>debian-dual:~# df -h /mnt/loop
>Filesystem Size Used Avail Use% Mounted on
>/root/virtual_fs 2.0G 33M 1.9G 2% /mnt/loop
>debian-dual:~# ls -lhs virtual_fs
> 65M -rw-r--r-- 1 root root 2.1G Jul 25 09:22 virtual_fs
>debian-dual:~#
>
>All fine till now. The virtual filesystem has 2.0G of room, but currently
>occupies just 65M of real disk space. Let's put some stuff in it.
>
>debian-dual:~# cp -a /home/ /mnt/loop/
[snip]
>debian-dual:~# df -h /mnt/loop/
>Filesystem Size Used Avail Use% Mounted on
>/root/virtual_fs 2.0G 305M 1.6G 16% /mnt/loop
>debian-dual:~#
>
>Okay. Now I want to compress the file that holds the virtual filesystem.
I have zero experience with compressed filesystems, but here goes: did
you umount the fs before trying to compress/decompress it? If not, are
you supposed to be able to do this without umounting it?
>
>debian-dual:~# ls -lhs virtual_fs
>367M -rw-r--r-- 1 root root 2.1G Jul 25 09:22 virtual_fs
>debian-dual:~# gzip virtual_fs
>debian-dual:~# ls -lhs virtual_fs.gz
>173M -rw-r--r-- 1 root root 173M Jul 25 09:22 virtual_fs.gz
>debian-dual:~#
>
>The problem, now, is that if I try to uncompress this file, it starts
>consuming the full 2.0G space!
>
>debian-dual:~# gunzip virtual_fs.gz &
>[1] 1176
>debian-dual:~# ls -lhs virtual_fs
>206M -rw------- 1 root root 205M Jul 25 13:01 virtual_fs
>debian-dual:~# ls -lhs virtual_fs
>557M -rw------- 1 root root 556M Jul 25 13:01 virtual_fs
>debian-dual:~#
>
>How is it possible to compress/uncompress such a file, so that only the
>real space needed (367M in our case) is occupied?
>
--
Cheers,
Bob Schmertz
More information about the wplug
mailing list