[lxc-users] Correct way to rsync /var/lib/lxd
Serge Hallyn
serge.hallyn at ubuntu.com
Sat Aug 8 18:32:26 UTC 2015
Quoting Mark Constable (markc at renta.net):
> I'm just trying to do a simple rsync backup of /var/lib/lxd/ to a local NAS and get
> these errors as root on the host. I understand the issue of subgids and subuids not
> being valid on the target machine (the below errors are coming from the destination)
Not valid - is that because the NAS only supports a single uid, i.e. it's vfat or
somesuch? Or does it support a smaller range?
> outside the normal range of uid/gids but I'm still not sure of the best flags, if any,
> to provide for rsync to get around this? Or is there a better way to backup containers?
>
>
> rsync: delete_file: rmdir(lxc/container1/rootfs) failed: Permission denied (13)
> rsync: delete_file: unlink(lxc/container1/metadata.yaml) failed: Permission denied (13)
> cannot delete non-empty directory: lxc/container1
> rsync: delete_file: rmdir(lxc/container1) failed: Permission denied (13)
> rsync: delete_file: unlink(lxc/lxc-monitord.log) failed: Permission denied (13)
> cannot delete non-empty directory: lxc
> rsync: failed to set times on "/mbox/var/lib/lxd/unix.socket" (in backups): Operation not permitted (1)
> rsync: recv_generator: mkdir "/mbox/var/lib/lxd/containers" (in backups) failed: Permission denied (13)
You could just tar up each container directory, or the whole thing, and back that
up. Or, if the NAS does support a reasonable range of uids (i.e. up to 65k, or
even 4k depending on your containers) you might be able to set up a separate
lxd instances with uids 0-65k mapped to 0-65k, i.e. identity mapping, and with
the NAS mounted as its LXD_DIR, then use 'lxc copy host:container nas:container',
and let lxd remap for you. Or just remap by hand with fuidmap which ships
with the lxd git tree.
-serge
More information about the lxc-users
mailing list