I am a relatively new admin of an LXD environment where I built several Drupal/MariaDB systems. Two simple ubuntu containers: a basic web server and database .
I’m trying to protect myself from disaster or human error by nightly (sure, sure, more likely weekly if this is manual) backups.
I have two servers that are nearly identical and only host the LXD containers. Prime = hp-elitedesk-20 while the Backup is hp-elitedesk-23
My caveman style hammer method now is this:
On the prime machine (20):
lxc project switch bucks
lxc ls
lxc stop mariadb-bc
lxc stop drupal-bc
lxc snapshot mariadb-bc Bucks_2023_03_02
lxc snapshot drupal-bc Bucks_2023_03_02
lxc start mariadb-bc
lxc start drupal-bc
lxc ls
# lxc exec mariadb-bc -- /bin/bash
# lxc exec drupal-bc -- /bin/bash
# 20 to → 23
lxc copy mariadb-bc/Bucks_2023_03_02 --target-project bucks hp-elitedesk-23:mariadb-bc
lxc copy drupal-bc/Bucks_2023_03_02 --target-project bucks hp-elitedesk-23:drupal-bc
Now I have noticed that if the containers already exist on the backup (23) then the copy fails so I am doing a pre-step on the backup where I
lxc project switch bucks
lxc stop mariadb-bc
lxc stop drupal-bc
lxc delete mariadb-bc
lxc delete drupal-bc
So my first question, is this a particularly bad method to avoid? Is there a better method?
Second, is there a way for me to copy the prime snapshot to the backup machine without deleting it from the backup first? Maybe copy the snapshot on the prime to a snapshot on the backup? Does this make sense? I might not be using the best language to convey the question.
Thanks for any help!