Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

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

over 4 years ago · Santiago Trujillo Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda