Change ZFS device names

Mrt12

Well-Known Member
May 19, 2019
119
9
58
44
I created a zpool where I used the disk ID names from
Code:
/dev/disk/by-id
. This works fine, however I recently read about the vdev_id.conf file. I created my own
Code:
vdev_id.conf
where I could create disk aliases for the slots where the disks are in, so I have my disks now accessible through
Code:
/dev/disk/by-vdev/slot0
and so on. This is very convenient, because with the ID notation it can become difficult to find out in which slot a specific disk is, but with the vdev file it is much easier.
So I would like to change my zpool to use my own device names. I read that this is possible with
Code:
zpool export tank
followed by
Code:
zpool import tank -d /dev/disk/by-vdev

So I tried to do that. But when I exported my zpool called "tank", it appeared that Proxmox immediately re-imported it. Because when I tried to use "zpool import", the pool was already imported, still using the old disk names.
I have a few containers, having their disks as subvolumes in my tank, and I also have the VM images in a Proxmox storage, also on that tank. Of course I had the VMs and containers stopped before I did the export!

So what is the right way to export a zpool in such a configuration?

Do I need to stop some Proxmox services before I can proceed? It looks like someone automatically imports my pool after I have exported it, without my interaction. On one hand this is awesome, but in this particular situation it is not so handy.
 
you want to disable the storage to prevent an automatic import

can I temporarily do that without affecting my existing VMs?
I assume you are talking about the storage in the "Datacenter".

So the steps would be
a) disable storage
b) zpool export tank
c) zpool import tank -d /dev/disk/by-vdev
right?

I just tested following:

zpool export tank && zpool import tank -d /dev/disk/by-vdev/

and for just one second I saw the device names from my vdev_id.conf, but then it reverted to the old disk/by-id names. Why is that?
 
mhmm... works here without problems:

1. disabled storage in datacenter->storage
2. edited vdev_id.conf (in my example a single device with alias d1 /dev/disk/by-id/ww......)
3. zpool export mytestzfs && zpool import -d /dev/disk/by-vdev mytestzfs
4. zpool status shows:
Code:
...
mytestzfs ONLINE
  d1      ONLINE
...
5. reenabled storage
 
HA! temporarily disabling the storage helped a lot. With that it worked like a charm and stays permanent, even survives a reboot - as intended. Thanks!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!