In the last days i have to move some Docker Containers from one host to another. First i start by simple scp the /var/lib/docker Directory to the new place. However, I quickly realized that this would take too long (many small files). So i started looking for alternatives. I could still remember that a btrfs works under the Docker. Solution found 😀

  1. create a Snapshot of the Subvolume that contains the Docker staff:
    btrfs subvolume snapshot -r /var /var/backup 
    sync

After this we can distribute a copy of this subvolume to the new Server that also have a btrfs Filesystem running with btrfs send and btrfs receive

    btrfs send /var/backup | ssh mover@target "btrfs receive /var/target"

This can take some time but is much faster then scp because a stream is send. If all is sucessfull you have a copy of the Subvolume on the target server. you can copy the needed stuff or make the Subvolume rw.

for more Informations have a look:

https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/Incremental_Backup.html

Previous Post Next Post