LXConsole Backup Storage

This is a follow-on to the article where I discussed how to have LXD-Dashboard backups (exports) stored outside of your LXD-Dashboard container. This time, I show how to do the same thing with LXConsole on the incus host on which LXConsole is running.

You can take this a step further and make the folder a mount point for either another disk or an NFS share to store your LXConsole backups.

In my tutorial entitled LXConsole Web Interface for Incus I create an incus container named “LXConsole” and I install the lxconsole docker application inside that container.

In the docker compose file I used, note that I have a folder defined for the backups:

services:
  lxconsole:
    image: 'penninglabs/lxconsole:latest'
    restart: unless-stopped
    ports:
      - '80:5000'
    volumes:
      - /home/scott/lxcbackups:/opt/lxconsole/backups
      - ./certs:/opt/lxconsole/certs
      - ./server:/opt/lxconsole/instance

This is great because it allows the backup files to be stored in the “/home/scott/lxcbackups” (linux container backups since LXConsole can manage both LXD and Incus servers and they both use “lxc” as their underlying architecture) location.

The issue is that the backups are inside of the incus container running LXConsole and that container will grow quite large with backups.

So, in order to store the backups outside of the LXConsole container, we want to go to your incus server (not the LXConsole container) and create a folder to map the backups into. Adjust the name to your liking. I put this in my home folder.

mkdir /home/scott/lxcbackups

Then we need to map this folder to the folder inside the LXConsole container. So, still on the incus server:

incus config device add LXConsole backups disk source=/home/scott/lxcbackups path=/home/scott/lxcbackups

The above command maps the backup files to the incus server. The problem is that we need write access to that folder outside of the container. I am assuming that you have the [1001,1001] as your UID/GID in the container which will be the case if you followed my LXConsole installation tutorial. So, issue these commands:

echo "root:1000:1" | sudo tee -a /etc/subuid /etc/subgid
incus config set LXConsole raw.idmap "both 1000 1001"

At this point, you have a folder on the incus server named “/home/scott/lxcbackups” (insert your name) in which LXConsole backups are stored.

I took this one step further on my incus server. I didn’t want my incus/lxd server backups from LXConsole to use up space on my incus server.

One thing you could do is to mount another disk on the incus server and use “/home/scott/lxcbackups” as a mount point to that disk.

In my case, I have a rather large NAS and so I NFS mounted that storage through that mount point. I put my nfs mounting in the “/etc/fstab” file so that the location would be mounted automatically when the incus server boots.

Here’s my entry in fstab as an example.

172.16.1.58:/lxcimages /home/scott/lxcbackups nfs defaults 0 0

The point of all this is to place the backups that you make in the LXConsole GUI in a safe place.