How to copy /var/lib/docker with overlayfs directory structure with data *as-is* without increasing the storage space How to copy /var/lib/docker with overlayfs directory structure with data *as-is* without increasing the storage space docker docker

How to copy /var/lib/docker with overlayfs directory structure with data *as-is* without increasing the storage space


It turned out that docker is using hardlinks within those directories under /var/lib/docker/overlay. Using -H with rsync (copy hardlinks as hardlinks) solved the issue.

rsync -avPHSX /var/lib/docker /new/partition/