Rename Storage Name Config

Not sure if this has been asking already, did not find anything.
On LXD 3.0 , I created a storage and the name of if became "local"
I would like to change the name only , the reference in LXD

lxc storage list
| local |             | zfs    | CREATED | 4       |

My zpool have a name like lxd300G01, but I can’t find any reference to it either.

 lxc storage show local
config: {}
description: ""
name: local
driver: zfs

Containers and images are correctly using the zfs pool lxd300G01 used as “local” name in LXD
Is that possible to rename “local” to “lxd300G01” ?


We don’t appear to have an API endpoint to rename storage pools.
I can’t remember if there was a good reason for it (difficulty in renaming some storage pools) or if it’s just an omission.


Thanks .
I thought the “local” was only a label that I could change.

Because I did not wanted “local” as storage pool name in LXD if my pool name in ZFS is actually "lxd300G01"
And now in fact, my profiles have “local” as a reference for pool storage witch does not help

My question is not about changing the name of the storage name in ZFS, but just in LXD :slight_smile:
I will see, worse case I can delete it, it’s fresh new

If lxc storage show local show a zfs.pool_name and source property both pointing at your zpool AND you’re not using a loop-based pool, then you should be able to perform the rename in the database with:

lxd sql global "UPDATE storage_pools SET name='lxd300G01' WHERE name='local';
lxd sql global "UPDATE profiles_devices_config SET value='lxd300G01' WHERE value='local' AND key='pool';

That assumes LXD 3.1 or the LXD snap, the should just be lxd sql instead of lxd sql global if running on the deb version of LXD 3.0.

That’s relatively untested, so I’d recommend restarting LXD after that’s changed and look at the logs for any storage related errors.

The weird thing is I don’t see any “source” or any info related to my zfs pool name

   lxc storage show local
config: {}
description: ""
name: local
driver: zfs
- /1.0/containers/testing01
- /1.0/images/5e7e0d3840249b72cf98e8b4931c7927fa10e9eb3805176ec0a18349888bacf4
- /1.0/profiles/default
- /1.0/profiles/vps-base
status: Created
- node1

This is kind of weird .
I’m using lxd version 3.0.0

I will switch to LXD3.1 then and reconfigure storage pool .

Odd that you don’t have zfs.pool_name or the source property set on this pool, I’d have expected both of them to be set to lxd300G01, I actually wonder how this can work at all since there’s no clear relationship between local and lxd300G01 here…

What does lxd sql "SELECT * FROM storage_pools_config;" show you?
(or lxd sql global "SELECT * FROM storage_pools_config;" if using the snap)

lxd sql "SELECT * FROM storage_pools_config;"
| id         | storage_pool_id | node_id    | key                     | value     |
| 3          | 1               | 1          | source                  | lxd300G01 |
| 4          | 1               | 1          | volatile.initial_source | lxd300G01 |
| 5          | 1               | 1          | zfs.pool_name           | lxd300G01 |

Here they are :confused:

Not sure why they’re not showing up then… anyway, as they’re clearly properly set, the rename instructions followed by a restart of the LXD daemon should be fine.

We explicitly decided to not support renaming storage pools as this is a pretty costly and insecure task. I mean even for renaming storage volumes we have to do a lot of work and it’s not super safe either.

Yes I totally understand that .
Maybe the title of this thread is not the best :slight_smile:
I don’t want LXD to rename any storage or volume from a storage point of view but only from an LXD view.

Because on a fresh install, with LXD 3.0 or LXD 3.1 , when using lxd init , the storage end up naming LOCAL
And that’s not the best for me as I want to be able to know what ZPOOL i’m using when doinglxc storage list

So when i configure LXD , I don’t add volumes, I skip it and I add it later with :

lxc storage create lxd300G01 zfs source=/dev/sdb description="LXD Storage 01"

I did try to rename using @stgraber cmd line with SQL, but I have an error , not sure if that is normal on a new install :

lvl=info msg="Starting /dev/lxd handler:" t=2018-05-29T11:44:12+0000
lvl=info msg=" - binding devlxd socket" socket=/var/snap/lxd/common/lxd/devlxd/sock t=2018-05-29T11:44:12+0000
lvl=info msg="REST API daemon:" t=2018-05-29T11:44:12+0000
lvl=info msg=" - binding Unix socket" socket=/var/snap/lxd/common/lxd/unix.socket t=2018-05-29T11:44:12+0000
lvl=info msg=" - binding TCP socket" socket=[::]:8443 t=2018-05-29T11:44:12+0000
lvl=info msg="Initializing global database" t=2018-05-29T11:44:12+0000
lvl=warn msg="Failed connecting to global database (attempt 6): gRPC grpcConnection failed: context deadline exceeded" t=2018-05-29T11:45:34+0000

SQL command on global says the same error.
Maybe the Database only get to work when there is more than one member in the cluster ?

Thanks for your help :slight_smile:

That won’t work though since it requires that all kinds of symlinks and mountpoints on-disk are updated. It also would involve updating all storage volumes that are currently attached to containers etc.