How to rsync a chroot without breaking symlinks

chrootrsyncsymlink

I'd like to rsync (backup) a chroot environment from outside the chroot.
For that I first make a lvm snapshot of the chroot volume and then run rsync on that.

The only problem with this approach: Symlinks that inside the chroot are absolute are now pointing to the outer-chroot-system and are of course not matching. Since I would like to use copy-unsafe-links, this leads to a false link resolution.
Is there a way to make rsync resolve symlinks from another directory than the main root or is there another way to solve this?

Best Answer

You could replace your absolute symlinks with relative ones before doing the rsync.

Related Question