Given this sequence of commands…
$ pwd
/data/backup/rsnapshot
$ sudo du -csk daily.{2,3}/ruminant
1195040 daily.2/ruminant
36712 daily.3/ruminant
1231752 total
$ ls -isk /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmunix \
/data/backup/rsnapshot/daily.3/ruminant/home/andy/vmlinux2
13344429 6728 /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmlinux2
16476851 6728 /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmunix
$ sudo ln -f /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmunix \
/data/backup/rsnapshot/daily.3/ruminant/home/andy/vmlinux2
$ ls -isk /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmunix \
/data/backup/rsnapshot/daily.3/ruminant/home/andy/vmlinux2
16476851 6728 /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmlinux2
16476851 6728 /data/backup/rsnapshot/daily.3/ruminant/home/andy/vmunix
$ sudo du -csk daily.{2,3}/ruminant
1195040 daily.2/ruminant
36712 daily.3/ruminant
1231752 total
…why does the usage of these two directories remain at 1,231,752k after the two clearly different files are hard linked together? I would have expected /data/backup/rsnapshot/daily.3/ruminant to now be 6,728k smaller.
ext3 filesystem mounted at /data/backup, Linux Debian squeeze host.
I've checked with lsof | grep deleted
that neither file is being held open by some process.
daily.2/ruminant
may still contain links to the same inode (13344429), so total size hasn't gone down as the space is still allocated and in use in that directory.A couple of related points:
a) If you had only run
du -sk daily.3/ruminant
then you probably would see a reduction in the total, since there are (presumably) no more links to that inode in thedaily.3
directory.b)
du
counts inodes as it goes in argument order, so in the first printout it assigned the usage of inode 13344429 todaily.2
rather thandaily.3
. Therefore removing the link fromdaily.3
(and leaving it indaily.2
) wouldn't result in any space reduction when counting bothdaily.{2,3}
since it's still counted indaily.2
.