[Users] Backing up ploop-based containers
Andrew Vagin
avagin at parallels.com
Mon Jul 1 08:24:21 EDT 2013
On Sat, Jun 29, 2013 at 05:25:38PM +0400, Dmitry Kopytov wrote:
> On Fri, Mar 22, 2013 at 10:35:26AM +0400, Andrew Vagin wrote:
> > Below you can find my example:
> >
> > A list of ploop files before backing up.
> > # ls -l /vz/private/3333/root.hdd/
> > drwx------ 4 root root 4096 Oct 8 06:52 cache-private
> > drwxr-xr-x 2 root root 4096 Oct 8 06:51 cache-root
> > -rw-r--r-- 1 root root 827 Mar 22 09:57 DiskDescriptor.xml
> > -rw------- 1 root root 0 Oct 8 06:51 DiskDescriptor.xml.lck
> > -rw------- 1 root root 10738466816 Mar 22 09:57 root.hds
> > drwx------ 2 root root 4096 Mar 22 09:57 root.hds.mnt
> > drwxr-xr-x 3 root root 4096 Oct 8 06:52 templates
> >
> > Create a snapshot:
> > # vzctl snapshot 3333
> > Creating snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59}
> > Creating delta /vz/private/3333/root.hdd/root.hds.{fb865531-cf3d-4d24-ba02-78d93a9659eb} bs=2048 size=20971520 sectors
> >
> > # ls -l /vz/private/3333/root.hdd/
> > total 10502168
> > drwx------ 4 root root 4096 Oct 8 06:52 cache-private
> > drwxr-xr-x 2 root root 4096 Oct 8 06:51 cache-root
> > -rw-r--r-- 1 root root 1168 Mar 22 10:01 DiskDescriptor.xml
> > -rw------- 1 root root 0 Oct 8 06:51 DiskDescriptor.xml.lck
> > -rw------- 1 root root 10738466816 Mar 22 09:57 root.hds
> > -rw------- 1 root root 9437184 Mar 22 10:01 root.hds.{fb865531-cf3d-4d24-ba02-78d93a9659eb}
> > drwx------ 2 root root 4096 Mar 22 09:57 root.hds.mnt
> > drwxr-xr-x 3 root root 4096 Oct 8 06:52 templates
> >
> > Now you can see a new file
> > root.hds.{fb865531-cf3d-4d24-ba02-78d93a9659eb}. It's a new delta,
> > where the ploop saves all new blocks. This file should be skipped
> > during back up. root.hds will not be changed and it contains all
> > blocks before snapshot.
> >
> > Create a reserve copy
> > # tar -pczf /vz/backup.tar.gz -C /vz/private/3333 . --exclude='root.hds.{fb865531-cf3d-4d24-ba02-78d93a9659eb}'
>
> Hi Andrew!
>
> It seems that "vzctl snapshot-switch" now needs a delta file to be exist
> (but why?). If a delta skipped during back up then you will have this
> error:
>
> > Restore from the reserve copy
> > # tar -xzf /vz/backup.tar.gz -C /vz/private/3333 .
> > # vzctl snapshot-switch 3333 --id '{58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59}'
> Switching to snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59}
> Storing /vz/private/3333/Snapshots.xml.tmp
> Opening delta /vz/private/3333/root.hdd/root.hdd.{fb865531-cf3d-4d24-ba02-78d93a9659eb}
> Error in open_delta_simple (delta_read.c:127): open /vz/private/3333/root.hdd/root.hdd.{fb865531-cf3d-4d24-ba02-78d93a9659eb}: No such file or directory
> Failed to switch to snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59}
Was CT is in running state before snapshot-switch?
Could you try to stop CT before switching to snapshot?
>
> So a container will fail to mount and start...
>
> As a workaround it is possible to put any other delta file there. For
> example:
>
> # vzctl snapshot 3334
> Creating snapshot {e3483596-a2b8-47d0-a8d9-29e04e2c86fe}
> Storing /vz/private/3334/Snapshots.xml.tmp
> Setting up checkpoint...
> suspend...
> get context...
> Checkpointing completed successfully
> Storing /vz/private/3334/root.hdd/DiskDescriptor.xml.tmp
> Creating delta /vz/private/3334/root.hdd/root.hdd.{6adaf97d-b511-47c7-9902-0a58c41d8f0c} bs=2048 size=104857600 sectors v1
> Creating snapshot dev=/dev/ploop12530 img=/vz/private/3334/root.hdd/root.hdd.{6adaf97d-b511-47c7-9902-0a58c41d8f0c}
> ploop snapshot {e3483596-a2b8-47d0-a8d9-29e04e2c86fe} has been successfully created
> Setting up checkpoint...
> join context..
> dump...
> Checkpointing completed successfully
> Resuming...
> Snapshot {e3483596-a2b8-47d0-a8d9-29e04e2c86fe} has been successfully created
>
> # cp /vz/private/3334/root.hdd/root.hdd.{6adaf97d-b511-47c7-9902-0a58c41d8f0c} /vz/private/3333/root.hdd/root.hdd.{fb865531-cf3d-4d24-ba02-78d93a9659eb}
> # vzctl snapshot-delete 3334 --id e3483596-a2b8-47d0-a8d9-29e04e2c86fe
>
> Now you can switch a restored container.
>
> # vzctl snapshot-switch 3333 --id 58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59
> Switching to snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59}
> Storing /vz/private/3333/Snapshots.xml.tmp
> Opening delta /vz/private/3333/root.hdd/root.hdd.{fb865531-cf3d-4d24-ba02-78d93a9659eb}
> Storing /vz/private/3333/root.hdd/DiskDescriptor.xml.tmp
> Creating delta /vz/private/3333/root.hdd/root.hdd.{0f6a3e7b-b2a1-433b-93f8-c58854e27d61} bs=2048 size=104857600 sectors v1
> Removing /vz/private/3333/root.hdd/root.hdd.{fb865531-cf3d-4d24-ba02-78d93a9659eb}
> ploop snapshot has been successfully switched
> Container has been successfully switched to another snapshot
>
> And delete a delta:
>
> # vzctl snapshot-delete 3333 --id '58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59'
> Deleting snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59}
> Storing /vz/private/3333/Snapshots.xml.tmp
> Opening delta /vz/private/3333/root.hdd/root.hdd.{0f6a3e7b-b2a1-433b-93f8-c58854e27d61}
> Opening delta /vz/private/3333/root.hdd/root.hdd
> Storing /vz/private/3333/root.hdd/DiskDescriptor.xml
> Removing /vz/private/3333/root.hdd/root.hdd.{0f6a3e7b-b2a1-433b-93f8-c58854e27d61}
> ploop snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59} has been successfully merged
> Snapshot {58b51034-0bd9-4d5f-b6d5-7f5fdde8ad59} has been successfully deleted
>
> --
> Dmitry Kopytov, Fozzy System Administrator
> kopytov at webzilla.com | http://www.webzilla.com/ | http://fozzy.com/
>
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://lists.openvz.org/mailman/listinfo/users
More information about the Users
mailing list