Capable of updating, snapshotting, backing up and migrating containers individually or en-masse.
Can also mass clean existing snapshots and backups (assuming they have the container's name in their filename) for one container or all containers.
Useful for automation.
Tested on LXD 3.20 running in Snap on Fedora 30
Capable of updating containers running:
- Ubuntu, Debian, Devuan, Kali, Linux Mint
- Alpine Linux
- CentOS, Fedora
- Arch Linux
Want to add your own? See: distroCommand
Modify the script to change these if required.
runCommands = 1
debug = 0
lxcPath = "/snap/bin/lxc" # YOU WILL MOST LIKELY NEED TO CHANGE THIS
lxdBridge = "lxdbr0"
backupFolder = CURRENT WORKING DIRECTORY + "/lxd-backups/"
sortListBy = "ipv4"
sortListReverse = False
help
list [backups/snapshots]
update <container-name/ALL>
snapshot <container-name/ALL>
backup <container-name/ALL>
migrate <container-name/ALL> <storage-pool> <remote-name>
cleanup <snapshots/backups> <container-name/ALL>
set-ipv4 <container-name> <ipv4>
Could horribly break everything!
I take no responsibility over the use of this random unofficial LXD helper script you found on the Internet.
Use with runCommands = 0 and debug = 1 if you want a list of commands generated by this script instead of actually running them.
- python3.x
- PrettyTable
sudo pip3 install PrettyTable
chmod +x lxd-tools
./lxd-tools <parameters>
(OPTIONAL)
sudo pip3 install PrettyTable
git clone https://github.com/unendingPattern/lxd-tools.git
sudo cp -f lxd-tools/lxd-tools /usr/local/bin
sudo chmod +x /usr/local/bin/lxd-tools
lxd-tools <parameters>
OR
sudo pip3 install PrettyTable
sudo wget -O /usr/local/bin/lxd-tools https://github.com/unendingPattern/lxd-tools/raw/master/lxd-tools
sudo chmod +x /usr/local/bin/lxd-tools
lxd-tools <parameters>
Backup all containers at midnight:
0 0 * * * path/to/lxd-tools backup ALL
Backup a specific container at 04:05 AM:
5 4 * * * path/to/lxd-tools backup specific-container