[lxc-users] Correct way to rsync /var/lib/lxd

Serge Hallyn serge.hallyn at ubuntu.com
Sun Aug 9 15:48:07 UTC 2015


Quoting Mark Constable (markc at renta.net):
> On Sat, 8 Aug 2015 06:32:26 PM Serge Hallyn wrote:
> > > I'm just trying to do a simple rsync backup of /var/lib/lxd/ to a local NAS
> > 
> > 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?
> 
> No it's a ubuntu 15.04 server based HP microserver running btrfs RAID10.
>  
> > > rsync: recv_generator: mkdir "/mbox/var/lib/lxd/containers" (in backups)
> > > failed: Permission denied (13)
> 
> What I neglected to mention is that I am using rsync:: direct without going via
> SSH and there is my (doh, brainfart) problem. The remote rsyncd daemon is running
> as a single non-root user and I obviously need to rsync as root... via SSH!
> 
> Yes, doing that as I type, problem solved.
> 
> > You could just tar up each container directory, or the whole thing, and back
> > that up.
> 
> Gladly I won't have to resort to that compared to an incremental rsync via cron.
> 
> A few questions though...
> 
> Should I be able to use btrfs send/receive?
> 
> Would that be more efficient than rsync?

AFAIK that should work and should be more efficient.  No direct support in
lxd for that (yet, don't recall whether that ended up on the roadmap or
not)

> Any other "native" methods for backing up containers?

It's not "backing up" per se, but I think you would simply set up another
private lxd server and 'lxc publish container backup:'.  Or actually, since
you'd want to do it regularly,

	lxc snapshot container snap-$(date +%Y-%m-%d)
	lxc publish container/snap-$(date +%Y-%m-%d) backup:

Again the 'backup:' remote could just be a second local lxd with a LXD_DIR
based on an nas, ceph fs, whatever.

> Thanks for your help and sorry about the noise.

This isn't noise at all.  It's important to discuss whether/how lxd fits
into various users' use cases.  Thanks for bringing it up.

-serge


More information about the lxc-users mailing list