Re: [lxc-users] Online container backup

2015-06-11 Thread Tamas Papp



On 06/11/2015 08:51 AM, Narcis Garcia wrote:

Debian 8 in a single and tratitional ext4 partition.
My idea is that the backup is a complete container export, to be
restored in another box if necessary.

Is there some newer LXC repository for Debian as ppa:ubuntu-lxc/daily ?

At this moment, my procedure is:
$ lxc-stop -n MyGuest
$ tar -cjf /var/backups/MyGuest.tar.bz2 /var/lib/lxc/MyGuest
$ lxc-start -n MyGuest
but container unavailability is too long.


You were referring to backup.
If you want live migration, use criu, as Fajar told it.
+ rsync:

$ rsync
$ criu
$ rsync delta
$ start

Or you can replace rsync with zfs/btrfs send/receive feature.


Another procedure, but without stopping container:
$ cp -aPx /var/lib/lxc/MyGuest /tmp/MyGuest
$ tar -cjf /var/backups/MyGuest.tar.bz2 /tmp/MyGuest


Snapshot is keyword, what you're looking for.


tamas
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Online container backup

2015-06-11 Thread Narcis Garcia
Why is a snapshot better with database services?
(time matter apart)


El 11/06/15 a les 08:58, Fajar A. Nugraha ha escrit:
> On Thu, Jun 11, 2015 at 1:51 PM, Narcis Garcia  > wrote:
> 
> Debian 8 in a single and tratitional ext4 partition.
> My idea is that the backup is a complete container export, to be
> restored in another box if necessary.
> 
> 
> 
> I highly recommend you switch to btrfs or zfs (I use zfs)
> 
>  
> 
> Is there some newer LXC repository for Debian as ppa:ubuntu-lxc/daily ?
> 
> 
> 
> You have to ask debian folks for that. AFAIK building from source should
> give you the same functionality though.
>  
> 
> 
> At this moment, my procedure is:
> $ lxc-stop -n MyGuest
> $ tar -cjf /var/backups/MyGuest.tar.bz2 /var/lib/lxc/MyGuest
> $ lxc-start -n MyGuest
> but container unavailability is too long.
> 
> 
> exactly. With zfs it's simply "zfs snapshot data/lxc/guest@backup-1",
> which often takes less than 1 second (and it doesn't block container IO)
>  
> 
> 
> Another procedure, but without stopping container:
> $ cp -aPx /var/lib/lxc/MyGuest /tmp/MyGuest
> $ tar -cjf /var/backups/MyGuest.tar.bz2 /tmp/MyGuest
> 
> 
> 
> Dangerous. If you have mysql (or another db) running on the container,
> you may be unable to start the it from backup later due to it
> complaining being corrupt.
> 
> -- 
> Fajar
> 
> 
> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
> 
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Online container backup

2015-06-11 Thread Fajar A. Nugraha
On Thu, Jun 11, 2015 at 2:07 PM, Narcis Garcia 
wrote:

> Why is a snapshot better with database services?
> (time matter apart)
>
>
That question is better suited for relevant db list/forum/support. Googling
"database backup inconsistent" should give you good reference (add "mysql"
or whatever db you use for more db-specific results).

Short version, copying files take a long time. Some files can be copied
early, while others can be copied some time later (e.g. several minutes or
hours later). If the database files are modified (e.g. you have an insert
query) during the copy operation, the db will most likely be corrupted.
Oracle should be able to work around this when runnning archivelog mode,
other db may not be able to.

Snapshot is different. All files in a snapshot can be seen as a "copy"
result taken entirely at the same, so there is no issue of "database files
modified during copy operation", since the "copy" process is instaneous.
This would result in the same state as if the server suddenly experience a
crash or power loss, and most dbs can recover cleanly from that condition.

-- 
Fajar
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] kernel crash when starting an unprivileged container

2015-06-11 Thread KATOH Yasufumi
Hi,

>>> On Wed, 3 Jun 2015 13:30:32 +0700
in message   "Re: [lxc-users] kernel crash when starting an unprivileged 
container"
  Fajar A. Nugraha-san wrote:

> On Wed, Jun 3, 2015 at 1:26 PM, Tomasz Chmielewski  wrote:
> > On 2015-06-03 15:01, Tomasz Chmielewski wrote:
> >>
> >> I'm trying to start an unprivileged container on Ubuntu 14.04;
> >> unfortunately, the kernel crashes.

> >> - kernel used is 4.0.4-040004-generic from
> >> http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0.4-wily/
> >

> Crash of unprivileged container on 4.0.x is a known issue, there are
> posts about it on this list.

This issue have been solved on 4.0.5 kernel. I've confirmed it now.
Unpriv container is worked fine.

-- 
KATOH Yasufumi
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] lxc-snapshot with btrfs on debian 8.1

2015-06-11 Thread Matthias Leopold

Hi,

i'm very new to lxc and btrfs. i'm just playing around and can't use 
lxc-snapshot like it's being described.


error looks like this

root@debian:~# lxc-snapshot -n c001
lxc_container: failed getting pathnames for cloned storage: 
/var/lib/lxc/c001/rootfs

lxc_container: Error copying storage
lxc_container: clone of /var/lib/lxc:c001 failed
lxc_container: Error creating a snapshot

some questions below. i admit to having rtfm'ed only quickly ;-)

do /var/lib/lxc and /var/lib/lxcsnaps have to reside on the _same_ btrfs 
filesystem for lxc-snaphot to work? currentyl i have two separate btrfs 
filesystems


is /var/lib/lxcsnaps used at all when doing snapshots on a btrfs 
/var/lib/lxc?


do btrfs snapshots have to reside below the snapshotted root?

is this related to 
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1414771 ?


thx
matthias



___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users