↑ ↓ select, Enter open, Esc close

Copy a directory locally with all permissions and attributes

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
rsync -aHAX --info=progress2 /var/www/vhosts/ /mnt/newdisk/vhosts/

-a preserves permissions, owners, groups, timestamps and symlinks, -H hard links, -A ACLs and -X extended attributes. --info=progress2 shows overall progress instead of one line per file. If the run is interrupted, running it again only transfers the rest.

Note: Files with the same name at the destination are overwritten. Owners can only be preserved when running as root.

Also searched as

  • move folder to new disk linux
  • copy vhosts to another partition
  • copy preserving permissions and owner
  • cp -a alternative with progress

Related one-liners

All in rsync and backup

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.