bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: du and tar: --exclude-from option


From: Bob Proulx
Subject: Re: du and tar: --exclude-from option
Date: Fri, 1 Nov 2002 19:12:55 -0700
User-agent: Mutt/1.4i

Jacob Elder <address@hidden> [2002-10-31 14:21:52 -0500]:
> So what is the idiomatic way to guess the size of an archive before writing
> to tape?

The silence has been deafening.  Probably everyone else is busy and so
I will jump in again.

> [...previously...]
> df reports that I'm using 2882M.
> tar --exclude-from says that the backup is 2722M.
> du with my tar-friendly exclude from reports that I'm using 2942M.
> du without any exclude file reports that I'm using exactly: 2942M.

I am not sure of the accuracy you wish.  To my mind those numbers are
all "close enough" and I would have been happy with that level of
detail.

If you need to know exactly then I can think of no way other than
simply looking at the size of the tar archive.  I realize this seems
like a lot of overhead.  It is a lot of overhead.  Hopefully someone
else will think of a better way.  But I know not the overhead factor
that tar needs in order to store files in a tar file enough to be able
to predict exactly the size of the archive.

  tar cvzf - $backuplist | wc -c

Recently I posted a snippet to count up the bytes in all files in a
directory tree.  Perhaps this is useful.

  find $backuplist -print0 | xargs -r0 ls -ld | awk '{sum+=$5}END{printf 
"%d\n", sum}'

You would probably need to play around with '-type f' and '! -type d'
and your exclude options in order to get a list that was the same and
generated a representative sized tar file.  Directories should
probably be excluded from this prediction.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]