1

When I'm trying to backup a disk with rsync, symbolic links are not resolved correctly.

For example:

media 
└disk1
  ├folder1
  │ └folder2 (symlink to /media/disk1/folder2)
  └folder2

After rsync -a /media/disk1/. /media/disk2 disk2 will look like this:

media 
└disk2
  ├folder1
  │ └folder2 (symlink to /media/disk1/folder2) <-- should be "disk2"
  └folder2

What I want is a solution to make symlinks "relative" or that rsync automatically adjust the link reference. Is that possible?

4

Use relative symlinks instead:

media 
└disk1
  ├folder1
  │ └folder2 (symlink to ../folder2)
  └folder2

When copied it will be the same, and since that is relative to the location, it will serve the same purpose in disk2.

In case that's not clear, the idea is:

cd /media/disk1/folder1
rm folder2
ln -s ../folder2 folder2

This last command is different than ln -s /media/disk1/folder2 folder2; in the first case the content of the link is a relative path, in the second it is absolute. You want to use relative paths, not absolute ones, in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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