Discussion:
[rsnapshot-discuss] Hard links on NFS?
Simon
2013-08-29 02:10:23 UTC
Permalink
Hi There,

Just wondering if someone could assist me in understanding the below? Sorry if this is a bit of a noobie question...

We have a debian squeeze VM ("backup") that performs rsnapshot (1.3.1-1) backups of several other VMs (via ssh) to a NFS mount (/mnt/backup = Synology NAS). When check the size of directories from the backup VM, i see this:

backup:/mnt/backup/backup_files/mail# du -sh *
9.3M daily.0
460K daily.1
464K daily.2
440K hourly.0
460K hourly.1
464K hourly.2
460K hourly.3

Which (I'm guessing) is showing that the hard links are working as expected and providing a minimal disk usage. However, if i login to the NAS and check the same directory, I'm seeing this:

storage> du -hs *
9.2M daily.0
9.2M daily.1
9.2M daily.2
9.2M hourly.0
9.2M hourly.1
9.2M hourly.2
9.2M hourly.3

In this case, the original file is on the VM being backed up - i had thought that having hard links on the NFS mount would show as hard links?

Again - sorry if this is a stupid question, but: Which is correct in terms of real disk usage?

Simon
Keith Keller
2013-08-29 02:47:56 UTC
Permalink
Post by Simon
backup:/mnt/backup/backup_files/mail# du -sh *
9.3M daily.0
460K daily.1
464K daily.2
440K hourly.0
460K hourly.1
464K hourly.2
460K hourly.3
Which (I'm guessing) is showing that the hard links are working as expected and providing a minimal disk usage.
This seems wrong. du should *not* compensate for hard links.
Post by Simon
storage> du -hs *
9.2M daily.0
9.2M daily.1
9.2M daily.2
9.2M hourly.0
9.2M hourly.1
9.2M hourly.2
9.2M hourly.3
Again - sorry if this is a stupid question, but: Which is correct in terms of real disk usage?
The NAS's du is likely reporting the "correct" use. du simply reports
on disk use of that file or directory, so you can not rely on it for
figuring out how much space is being used in total. You can try to
install rsnapshot-diff on the NAS, which can give you this information,
or you can check df, which reports actual disk use. (rsnapshot-diff
might report correctly when run from the VM, but I wouldn't want to say
definitively.)

--keith
--
***@wombat.san-francisco.ca.us
Rolf Muth
2013-08-29 07:40:06 UTC
Permalink
Hallo Keith Keller,
Post by Keith Keller
Post by Simon
...
Which (I'm guessing) is showing that the hard links are working
as expected and providing a minimal disk usage.
This seems wrong. du should *not* compensate for hard links.
On my machines, it does! (Suse 10.3 and 11.2)
--
Herzliche Grüße!
Rolf Muth
Meine Adressen dürfen nicht für Werbung verwendet werden!
OpenPGP Public Key:
http://pgp.uni-mainz.de:11371/pks/lookup?op=index&search=0x5544C89A
Steven Roberts
2013-08-29 03:28:54 UTC
Permalink
Post by Simon
Hi There,
Just wondering if someone could assist me in understanding the below?
Sorry if this is a bit of a noobie question...
We have a debian squeeze VM ("backup") that performs rsnapshot
(1.3.1-1) backups of several other VMs (via ssh) to a NFS mount
(/mnt/backup = Synology NAS). When check the size of directories from
backup:/mnt/backup/backup_files/mail# du -sh *
9.3M daily.0
460K daily.1
464K daily.2
440K hourly.0
460K hourly.1
464K hourly.2
460K hourly.3
Which (I'm guessing) is showing that the hard links are working as
expected and providing a minimal disk usage. However, if i login to
that is correct and the correct du behavior.

If you want to have du count all copies of the hard links you
can use the -l flag. from the man page:

`-l'
`--count-links'
Count the size of all files, even if they have appeared already
(as a hard link).

I use du without the -l all the time to see savings of using hard links
both with rsnapshot and other tools.
Post by Simon
storage> du -hs *
9.2M daily.0
9.2M daily.1
9.2M daily.2
9.2M hourly.0
9.2M hourly.1
9.2M hourly.2
9.2M hourly.3
In this case, the original file is on the VM being backed up - i had thought that having hard links on the NFS mount would show as hard links?
Again - sorry if this is a stupid question, but: Which is correct in terms of real disk usage?
on the unix box should be what is correct. I see the same behavior on
my synology with the du command. which is a bit odd as it also says
it has a -l flag. it does seem to be behaving as if it has the -l
flag set always. I did some quick searching but didn't see anything
but seems like a busybox bug maybe.

Steve
Simon
2013-09-05 21:16:49 UTC
Permalink
Post by Steven Roberts
Post by Simon
Hi There,
Just wondering if someone could assist me in understanding the below?
Sorry if this is a bit of a noobie question...
We have a debian squeeze VM ("backup") that performs rsnapshot
(1.3.1-1) backups of several other VMs (via ssh) to a NFS mount
(/mnt/backup = Synology NAS). When check the size of directories from
backup:/mnt/backup/backup_files/mail# du -sh *
9.3M daily.0
460K daily.1
464K daily.2
440K hourly.0
460K hourly.1
464K hourly.2
460K hourly.3
Which (I'm guessing) is showing that the hard links are working as
expected and providing a minimal disk usage. However, if i login to
that is correct and the correct du behavior.
If you want to have du count all copies of the hard links you
`-l'
`--count-links'
Count the size of all files, even if they have appeared already
(as a hard link).
I use du without the -l all the time to see savings of using hard links
both with rsnapshot and other tools.
Post by Simon
storage> du -hs *
9.2M daily.0
9.2M daily.1
9.2M daily.2
9.2M hourly.0
9.2M hourly.1
9.2M hourly.2
9.2M hourly.3
In this case, the original file is on the VM being backed up - i had thought that having hard links on the NFS mount would show as hard links?
Again - sorry if this is a stupid question, but: Which is correct in terms of real disk usage?
on the unix box should be what is correct. I see the same behavior on
my synology with the du command. which is a bit odd as it also says
it has a -l flag. it does seem to be behaving as if it has the -l
flag set always. I did some quick searching but didn't see anything
but seems like a busybox bug maybe.
Just a small update here for those that are interested.. We moved the rsnapshot process to run on the Synology (it has dual core 2.31 atoms) and now our backups are working correctly from a usage reporting point of view.

Simon

Edward Ned Harvey (rsnapshot)
2013-08-29 11:16:12 UTC
Permalink
Apparently, different versions of du count the disk usage differently. Simon, you've got two different machines accounting the same directory differently. Keith and Rolf see one of those behaviors ... Steven and I see the other behavior.
Simon
2013-08-29 22:47:35 UTC
Permalink
Apparently, different versions of du count the disk usage differently. Simon, you've got two different machines accounting the same directory differently. Keith and Rolf see one of those behaviors ... Steven and I see the other behaviour.
This is def an issue with the Synology:

storage> dd if=/dev/zero of=testfile bs=1M count=10
storage> ln testfile testfile2
storage> du -sh testfile*
10.0M testfile
10.0M testfile2
storage> du -slh testfile*
10.0M testfile
10.0M testfile2
Continue reading on narkive:
Loading...