How to specify storage directory path in incus admin init?

I am installing a testing setup of incus and would like to specify non-default path for the storage (dir backend).

The path in incus admin init is not prompted. How to specify it?

There are a few parameters in incus admin init --help of the type --storage*. These do not apply for the dir storage driver.

I do not think the setup wizard can help you specify a different directory. However, you can create it manually as follows.

Make the new directory, then create a new Incus storage for that directory. Finally, edit the Incus default profile to use the new Incus storage. From now on, the new instances will be created in the new directory.

root@mycontainer:~# mkdir /incus
root@mycontainer:~# incus storage create newstorage dir source=/incus
Storage pool newstorage created
root@mycontainer:~# incus storage list
+------------+--------+--------------------------------------+-------------+---------+---------+
|    NAME    | DRIVER |                SOURCE                | DESCRIPTION | USED BY |  STATE  |
+------------+--------+--------------------------------------+-------------+---------+---------+
| default    | dir    | /var/lib/incus/storage-pools/default |             | 1       | CREATED |
+------------+--------+--------------------------------------+-------------+---------+---------+
| newstorage | dir    | /incus                               |             | 0       | CREATED |
+------------+--------+--------------------------------------+-------------+---------+---------+
root@mycontainer:~# incus profile edit default
...
root@mycontainer:~#

Optional: If you were to automate this, you would run incus admin init --dump to get the current configuration with the new storage. Then, edit this configuration so that you use it when you configure new Incus installations in the future.

Exercise (not required): How do you make the new custom storage in Incus appear with the name default? (Hint: Create a temp storage, add it to the default profile, remove the default storage, recreate a storage named default with your custom directory, edit the default profile to reflect the change, finally, remove the temp storage.)

2 Likes

Wow, that’s a perfect solution, many thanks! In fact I discovered the ‘edit’ command earlier today, it is a very intuitive way to explore and edit incus configurations. Cheers!