Why do hardlinks take linear time?
On the behaviour of hardlinks..: I timed how long it takes to create a series of hardlinks to a single file. The time *per hardlink creation* clearly grows linearly with the link count, regardless of whether each new hardlink is linked to the previous one or directly to the original file. The same goes for deleting them. I had expected it to take constant time, being that each hardlink just points directly to the file's inode, and the inode knows the link count but doesn't point back to all its hardlinks. So creating a new hardlink need not (cannot!) visit all the other hardlinks. Yes no?
Reason I ask is that my simple little backup cron job is gradually taking longer to run each night. It essentially just does rsync -a --delete --link-dest=... to an external hard drive. I was going to do rotating backups. But at the rate at which the EHD is filling up, I'll have bought a bigger one long before this one ever runs out of space. Delighted with the possibility of having a snapshot for every single day, I don't delete any backups at all.
Works fine, except for taking about an hour longer per week. So that's not going to be feasible. I may have to resign to a less exhaustive backup structure, though suggestions are welcome if there's a way to keep them all without taking forever per backup. Mostly I'm just curious as to why hardlinking time seems to be linear in the link count. Any ideas?
-- Javhar
|