0

I want to create a perfect clone of a folder, including permissions and ownership.

I'm using command:

rsync -a <source> <destination>

The sync is missing some of the files that are root access only. How can I make a perfect clone, with everything?

2
  • 2
    Using sudo rsync ...? Or are you also concerned about hard links, sparse files, and ACLs?
    – Kusalananda
    Commented Mar 12, 2022 at 12:45
  • You have not mentioned which distribution you are using. So I assumed it is a distribution that brings the sudo command and that your user is configured to be allowed to use it.
    – Tim
    Commented Mar 12, 2022 at 17:42

1 Answer 1

1
sudo rsync -aHAX --delete <source> <destination>

sudo obtains root privileges.

And from man rsync:

--archive, -a            archive mode; equals -rlptgoD (no -H,-A,-X)
--hard-links, -H         preserve hard links
--acls, -A               preserve ACLs (implies --perms)
--xattrs, -X             preserve extended attributes
--delete                 delete extraneous files from dest dirs

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .