LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-04-2009, 04:29 PM   #1
javhar
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: 0
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
 
Old 07-04-2009, 04:45 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Isn't it the case that you're trying to make hard links across two different filesystems? Your internal drive and a USB doohickey? That's impossible so would result in the files being copied each time, which would explain the increase in time you're seeing. Or am I missing something critical here?
 
Old 07-04-2009, 05:09 PM   #3
javhar
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Original Poster
Rep: Reputation: 0
It takes linear time when I try timing hardlinks on just one filesystem. Also, rsync --link-dest=... creates hardlinks on the destination filesystem itself. That's working as expected; it's not copying the files each time, as the amount of used disk space on the backup disk grows only very slowly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
softlinks vs hardlinks irfanhab Linux - Newbie 4 02-06-2007 02:05 AM
can rsync change hardlinks instead of delete-recopy? allasso Linux - General 1 09-17-2006 10:46 AM
Cd image with hardlinks kvtournh Linux - Software 2 08-27-2006 05:22 AM
LXer: Linear Optimization with the GNU Linear Programming Kit LXer Syndicated Linux News 0 08-12-2006 04:21 AM
Lotsa hardlinks - how do I find the others? humbletech99 Linux - General 6 11-27-2005 01:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration