cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

middleware:container:lxd:backup.html



LXD CLI Commands Cheet Sheat

LXD : How to backup (snapshot,export)

Snapshot management

lxc snapshot CONTAINER
lxc snapshot CONTAINER SNAPSHOT-NAME
Creating a snapshot
lxc info CONTAINER Listing snapshots
lxc restore CONTAINER NAME Restoring a snapshot
lxc move CONTAINER/NAME CONTAINER/NEW-NAME Renaming a snapshot
lxc copy CONTAINER/SNAPSHOT NEW-CONTAINER Creating a new container from a snapshot
lxc delete CONTAINER/SNAPSHOT Deleting a snapshot


Cloning

lxc copy SOURCE DESTINATION Copying a container
MAC address will be reset
lxc move OLD NEW Moving a container
lxc stop CONTAINER
lxc copy SOURCE DESTINATION



while the source container is running, you could copy a snapshot.

lxc snapshot NODE:CONTAINTER  SNAPSHOT
lxc copy NODE:CONTAINER/SNAPSHOT  NEW-CONTAINER


Image

lxc image list Listing local images
lxc launch IMAGE CONTAINER importing images
lxc publish CONTAINER --alias NEW-IMAGE Turning a container into an image
lxc publish CONTAINER/SNAPSHOT --alias NEW-IMAGE turn a past container snapshot into a new image
lxc image import ARCHIVE
lxc image import ARCHIVE --alias NAME
Importing a tarball
lxc image delete NAME Deleting images


Export

Ex1

You must sotp VM.

# lxc list
# lxc publish CONTAINER --force --alias CONTAINER_`date -I`  <- Use --force to have it stopped and restarted.
# lxc image list
# lxc image export CONTAINER_`date -I`
# ls
xxxxxxxxxxxxxxxxx.tar.gz
Ex2

You don't need to sotp VM.

# lxc list
# lxc snapshot container_name snapshot_name
# lxc publish container_name/snapshot_name --alias image_name
# lxc image list
# lxc image export CONTAINER_`date -I`
# ls
xxxxxxxxxxxxxxxxx.tar.gz


Import

# lxc image import xxxxxxxxxxxxxx.tar.gz --alias=test1
# lxc image list
# lxc launch test1  test2

# lxc exec test2 bash


multiple hosts

server1# lxc config set core.https_address "[::]:8443"
server1# lxc config set core.trust_password PASSWORD
server2# lxc remote add SERVER-ALIAS   IP


Refelrences


LXD CLI Commands Cheet Sheat




middleware/container/lxd/backup.html.txt ยท Last modified: 2020/03/25 by admin

Page Tools