Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently I'm moving a big filesystem to a new server as the original fileserver is no longer able to handle the filesystem writes.

To make this quick I made symlinks at the target filesystem pointing to the original filesystem.

Initially: /company/release (mountpoint of the original filesystem)

After migration: /company/release.old (points to original filesystem after automount map update) /company/release (points to new fileserver/filesystem after automount map update)

In /company/release there are symlinks like the following: /company/release/product-1.0.tar.gz -> /company/release.old/product-1.0.tar.gz /company/release/product-1.0 -> /company/release.old/product-1.0 (this is a tree of files)

Using symlinks allowed me to move the writes to the new filesystem quickly. Now I'd like to slowly migrate the existing files and directories to the new filesystem.

The problem I'm running into is that since the symlinks point back at the original files rsync doesn't see any difference and so it doesn't actually copy the file(s) or directory(s) and remove/overwrite the symlinks.

Is there a set of rsync flags which will do what I want?

share|improve this question
add comment

2 Answers

The -a argument will do what you want, copy symlinks (among other things) so the destination will be "archival copy" of the source.

NOTE: the -a flag of cp which seems a lot like the rsync -a flag (in that it preserves all the attributes, date and time), DOESN'T remove the target before the copy, so it copies through any existing symlinks off to wherever they point.

Example: *Files a, b, c with strings "one", "two" and "three" in them respectively then have symlink aa pointing to a.*

With cp -a c aa, you will end up with "three" in a which seems really wrong until you realize they are doing POSX, and that means lowest common denominator.

With rsync -a c aa, the symlink aa is replaced with a file containing "three" and file a stays uncorrupted.

share|improve this answer
add comment

From the manpage:

        -L, --copy-links            transform symlink into referent file/dir
share|improve this answer
    
That's not quite what I'm looking for. I want to overwrite links on the target side, not copy from the source and make the links into real dir's on the target side. –  bdbaddog Nov 15 '12 at 23:18
add comment

Your Answer

 
discard

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.