Historical context
I had experience with a “plain” LXC in past. Now I decided to try Incus. For experiments, I’m heavily using tmpfs on my laptop.
I found that when I created a storage with, for example,
incus storage create "my_tmp" dir source='/tmp/incus_storage'
it became unavailable after the host restart (which makes sense). I see in logs:
time="2025-08-23T20:59:48+02:00" level=error msg="Failed mounting storage pool" err="Failed to mount \"/tmp/incus\" on \"/var/lib/incus/storage-pools/my_tmp\" using \"none\": no such file or directory" pool=my_tmp
time="2025-08-23T21:00:58+02:00" level=error msg="Failed mounting storage pool" err="Failed to mount \"/tmp/incus\" on \"/var/lib/incus/storage-pools/my_tmp\" using \"none\": no such file or directory" pool=my_tmp
time="2025-08-23T21:02:08+02:00" level=error msg="Failed mounting storage pool" err="Failed to mount \"/tmp/incus\" on \"/var/lib/incus/storage-pools/my_tmp\" using \"none\": no such file or directory" pool=my_tmp
and incus storage list gives:
+--------+--------+-------------+---------+-------------+
| NAME | DRIVER | DESCRIPTION | USED BY | STATE |
+--------+--------+-------------+---------+-------------+
| my_tmp | dir | | 0 | UNAVAILABLE |
+--------+--------+-------------+---------+-------------+
I found an interesting “feature”: after the directory created, I have to restart the incus service or just wait, because it looks like the daemon checks for availability every 70 seconds.
Then it becomes available:
+--------+--------+-------------+---------+---------+
| NAME | DRIVER | DESCRIPTION | USED BY | STATE |
+--------+--------+-------------+---------+---------+
| my_tmp | dir | | 0 | CREATED |
+--------+--------+-------------+---------+---------+
So in my script which creates a container, I use not really nice workaround:
if incus storage show "$INCUS_STORAGE_NAME" | grep '^status:' | grep -q -i '^status: Unavailable'; then # Another case is 'status: Created', then we just skip
echo "Because TMPFS is empty after OS restart, the pre-configured 'dir' storage could be unavailable, let's create it:"
INCUS_STORAGE_PATH="$(incus storage get "$INCUS_STORAGE_NAME" source)"
mkdir -pv "$INCUS_STORAGE_PATH"
echo "and then restart the Incus service (it requires root priveleges), OR JUST WAIT 1 MINUTE + 10 SECONDS AND RESTART THIS SCRIPT (check /var/log/incus/incus.log):"
sudo service incus restart
fi
Questions
- Do you know a way how to create an Incus storage directory automatically?
- Which permissions are better to set for an Incus storage directory?
- Do you have an idea how to force Incus to re-check a storage availability without restarting the whole service?
Also it would be nice to have an option for the storage with driver: dir to automatically create the directory when absent. I will probably create a GitHub issue for it.