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:~#
Advertisement
Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement