LXD container snapshot and restore

lxc allow you to take snapshot, restore snapshot of a container.

Here we create a snapshot, then delete the /etc folder from the container. Now the container is useless. Restore the container from snapshot to get it work again.

root@UNUSED:~# lxc snapshot my-vm-2 my-vm-2-snap1
root@UNUSED:~# lxc exec my-vm-2 -- rm -rf /etc
root@UNUSED:~# lxc exec my-vm-2 -- bash
I have no name!@my-vm-2:~# ls -l / | grep etc
I have no name!@my-vm-2:~# exit
root@UNUSED:~# lxc restore my-vm-2 my-vm-2-snap1
root@UNUSED:~# lxc exec my-vm-2 -- bash
root@my-vm-2:~# ls -l / | grep etc
drwxr-xr-x  89 root   root    4096 Aug 27 07:06 etc
root@my-vm-2:~# exit
root@UNUSED:~#

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *