Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 1TB xfs volumne on Amazon EBS, which contains 246GB of incremental backups, created with rsync and hardlinking. I want to copy this to a new, smaller disk.

The problem is it doesn't seem to fit into a 300GB disk. Is there any block size that I can investigate or something? I have recently removed 700GB of backups, do I need to clear something off? I'm using cp -R to copy between the mounted volumes

share|improve this question
up vote 0 down vote accepted

Using cp -R to copy your hardlinked data is removing the hardlinks.

$ du -sh one/ two/
140M    one
4.0K    two
$ cd one
~/one$ ln file1 file2
~/one$ ls -s
total 285280   
142640 file1  142640 file2
$ cd ..  
$ du -sh one two  
140M    one
4.0K    two

At this point ls shows two 140MB files, but they are hard linked, so du reports just 140MB in use.

$ cp -R ../one/* two/
$ du -sh one two
140M    one
279M    two

This shows that cp -R doesn't preserve the hardlink status.

The (or at least, one) right way to copy this is to use rsync again, with the -H (or --hard-links) parameter.

rsync -avPH one/ three
sending incremental file list
   146058808 100%  185.43MB/s    0:00:00 (xfer#1, to-check=0/3)
file1 => file2

sent 146076781 bytes  received 47 bytes  292153656.00 bytes/sec
total size is 292117616  speedup is 2.00
$ ls -s three/
total 285272  
142636 file1  142636 file2
$ du -sh three
140M    three
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.