Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
disk usage issue with rsync and --link-dest

I have disk usage problem with rsync and --link-dest Incremental backup is taking full disk space:

@localhost media]$ ls
orig
----------------------------------------------------
localhost media]$ du -sh .
25M .
----------------------------------------------------
localhost media]$ rsync -avh orig/ full
----------------------------------------------------
@localhost media]$ du -sh .
49M .
----------------------------------------------------
localhost media]$ echo 1111 > orig/foo111
----------------------------------------------------
localhost media]$ rsync -avh --link-dest=full orig/ orig_1
----------------------------------------------------
localhost media]$ ls orig_1/foo111 
orig_1/foo111
_____________________________________________________

localhost media]$ ls full/foo111
ls: cannot access full/foo111: No such file or directory

Everything looks good so far. The latest change is reflected in orig_1 But the directories aren't hard linked and they're all in full size.

-----------------------------------------------------
localhost media]$ du -sh .
74M .
---------------------------------------------
localhost media]$ du -sh orig_1/
25M orig_1/
--------------------------------------------
localhost media]$ du -sh orig
25M orig
---------------------------------------------
localhost media]$ du -sh full
25M full

Am I suppose to have the orig_1 size as 0? And stat command shows no hard links. What am I doing wrong?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

When you ran rsync -avh --link-dest=full orig/ orig_1, you ignored this error message (it's more obvious if you remove -v):

--link-dest arg does not exist: full

If we then take a look at man rsync under --link-dest, we find:

If DIR is a relative path, it is relative to the destination directory. 

And there it is. full is relative to the current directory. Relative to the destination directory, it would be ../full.

If you try again with rsync -avh --link-dest=../full orig/ orig_1, you get what you expect:

$ du -sh *
149M    full
149M    orig
232K    orig_1
$ du -sh .
298M    .

Note that, when counted individually, the directories still appear take up the full space:

$ du -sh orig_1 
149M    orig_1

This is because du keeps track of files it's already seen, and avoids counting them twice.

over 4 years ago · Santiago Trujillo Report

0

--link-dest takes a path relative to the destination. You want --link-dest=../orig.

over 4 years ago · Santiago Trujillo Report

0

Standard Unix filesystems do not allow hard links to directories, except for the special . and .. links. --link-dest only creates hard links for files, the rest of the directory structure is recreated as real directories.

And even if hard links were allowed to directories, du would still show the full size of each link. When using hard links, there's no distinction between the original and the link, they're each just names that refer to a particular inode, and du would scan them equivalently.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!