rsync - recursive and preserving permissions

Had a case where i need to sync up /hana/data dn /hana/log to a whole new disk..

i used rsync, but f-up the permission part..

so here's a note to myself

rsync -rlptgoDHAX <source-dir> <target-dir>

You want the -p flag:

    -p, --perms                 preserve permissions

I tend to always use the -a flag, which is an aggregation of -p and several other useful ones:

    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
 -H, --hard-links            Preserve hard links
-A, --acls
    This option causes rsync to update the destination ACLs to be the same as the source ACLs. The option also implies --perms.

    The source and destination systems must have compatible ACL entries for this option to work properly.
    See the --fake-super option for a way to backup and restore ACLs that are not compatible.

-X, --xattrs
    This option causes rsync to update the destination extended attributes to be the same as the source ones.

    For systems that support extended-attribute namespaces, a copy being done by a super-user copies all namespaces
    except system.*. A normal user only copies the user.* namespace. To be able to backup and restore non-user
    namespaces as a normal user, see the --fake-super option.


//alak

Comments

Popular posts from this blog

SAP Backdoors {placeholder Post]

SAP Fiori Launchpad Activation via Task List (STC01)

SAP SWPM Software Provision Manager SL Toolset 1.0 SP22 Startup Options