RSSAmplifier

davd.io · Mar 21, 2019

Move Docker Volumes using rsync

0
Sign in to vote or save

David Prandzioch · davd.io

I’m running a Docker host on a Hetzner Cloud server. Since my GitLab instance grew quite big, I bought some additional storage that’s mounted to the machine as a additional device. All my Docker stuff uses local volumes located in /var/lib/docker/volumes. The question now was: How to move those volumes to the new storage? Docker volumes are basically just subdirectories in a special folder. For some applications it’s important to copy over all the extended attributes and other metadata like permissions, ownership and change dates.

First off, I logged in as root, stopped the Docker daemon using systemctl stop docker. Then I copied /var/lib/docker/volumes to /var/lib/docker/_volumes, mounted the new block storage to the original volumes location and added it to /etc/fstab.

Then, it’s easy to copy over all the volume data. I started a tmux session and copied over all the files like this:

rsync -avX --progress /var/lib/docker/_volumes/ /var/lib/docker/volumes/

Afterwards, just start Docker again using systemctl start docker.

Read the original on davd.io

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.