Keith Owens <[EMAIL PROTECTED]> writes:

> [...]
> Just copying all files with chattr +c is not quite what I want
> because the original files might already be marked +c and I do not
> want to disturb that setting on backup.

If you do use e2compr but don't want to lose track of the attributes
of the originals, you can use the e2compr version of `find', which can
test for and display ext2 attributes:

  find / /usr /var /home -xdev \
      \! -attr '' -printf '=\0=\0=\0=%E\0%p\0' \
      -attr +cB -printf '-m\0%M\0-b\0%B\0%p\0' |
    gzip -9 > /tmp/attrs.gz

Restore them with:

  gzip -cd /tmp/attrs.gz |
    xargs -r -0 -n 5 chattr

(If you want to make the list more grepable (e.g. so that you can
restore the flags of selected files instead of everything), and you
know that none of your filenames have tab or newline characters, then
you could change the \0's to \t and \n, and put a `tr \\t\\n \\0\\0 |'
before the xargs.)

e2compr would meet all your stated requirements (compressed; metadata
not compressed; full support for ext2 attributes; fast access to
individual files; transparently de/compresses).  The commands you gave
should work exactly as they are except change "-t ext2_compress" to
simply "-t ext2", insert a "chattr +c /mnt" after the first mount, and
add the above commands where appropriate.  To minimize space usage,
I'd also suggest giving mke2fs options -s -b 1024 and -N with a number
determined from df -i.

HOWEVER, e2compr has not been ported to current 2.3 kernels.  (It
works on all versions up to about 2.3.9.)


If you want to use something other than e2compr, you can still use the
above commands, except get rid of line 3 (as %M and %B make sense only
under a kernel with e2compr support).  The modified version of
findutils can be found under
<http://cvs.bofh.asn.au/e2compr/ftp/apt/>.

The best alternatives to e2compr for your purposes that I know of are
Jean-Marc Verbavatz' DouBle
<http://perso.cybercable.fr/~verbavat/double/> (which provides a
compressed block device); and Pavel Machek's podfuk
<http://atrey.karlin.mff.cuni.cz/~pavel/podfuk/podfuk.html> (which is
a userfs replacement built on codafs; it can read .gz and .tar.gz
files, and I think it can read zip files, which are better for random
access because they're like a tar of gzipped files instead of a
gzipped big tar file).  I don't know whether or not they work with
kernel 2.3, though podfuk is reasonably likely to, as I don't think it
has any kernel changes of its own.

HTH,

pjm.

Reply via email to