A hard link problem

Cameron Simpson cs at zip.com.au
Wed Apr 15 00:10:18 UTC 2009


On 14Apr2009 10:34, m.roth2006 at rcn.com <m.roth2006 at rcn.com> wrote:
| We're backing up using rsync and hard links. The problem is that the
| fs is filling up *fast*.

Is this the usual scheme of:
  - hard link previous backup tree to new backup tree
  - rsync to new backup tree
?

(I gather you can nearly do that in one rsync step these days.)
Anyway, is that what you mean?

| According to df, 
| 154814444 108694756  38255576  74%
| According to du -s -k, I've got 123176708 in use, which appears larger
| (unless it's too early in the morning for me to read that right).

You may find "df -h" and "du -sh" more readable.

You can also take advantage of the fact that:

  du -sh backup1 backup2

will count a file hard linked only once (hopefully backup2's du count
will be quite small, since most stuff will have shown already in backup1).
i.e. that should show the incremental disc use of backup2.

Versus:

  du -sh backup1; du -sh backup2

which shows the total size of each.

| Now, ls -Ri | wc -l on one directory shows 10765, while ls -Ri | sort
| -u | wc -l in the same directory shows 3274, so yeah, there are a lot
| of hard links. What I need to figure out, so that we don't blow out the
| filesystem, is how much space is *really* in use.

df is instant and does not lie. The du incantations above should be
pretty effective. and informative too.

| I'd like something
| a bit faster and more elegant than, say, ls -Ri | awk '{print $!;}' >
| filelist, and then a shell script to loop
| | find /backup -inum $fromlist -ls | awk '{print $7;}' > total, and
| then awk '{total += $1;}END { print total;}' total

You may find "find -links +1" a quick way to find hardlinked files.

Does any of this help your quest?
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

George, discussing a patent and prior art:
"Look, this  publication has a date, the patent has a priority date,
can't you just compare them?"
Paul Sutcliffe:
"Not unless you're a lawyer."




More information about the redhat-list mailing list