How to change the drive reference in a zfs pool from /dev/sdX to /dev/disk/by-id (ata-XXXXXX)

rcd

Active Member
Jul 12, 2019
242
20
38
62
After having had a boot problem because I'd used device names for my zfs pool rather than ID's, I realize I have to change it.

Searching for hours, all I find are a couple of references that basically says to "just" ...

Code:
zpool export storage
zpool import storage -d /dev/disk/by-id

When I try that, I get a "cannot export 'poolz': pool is busy".

I've stopped all my VM's and I don't use the pool for anything like root or swap. lsof comes up blank as in nothing is using the pool. What can I do to export this?

Second question: If ever I manage to export the pool, I understand from the manpage that zpool import will want to use a new pool name. I'd prefer using the same old - is that possible? How? Once the pool is exported, can the old pool be deleted or something?
 
Is `poolz` your root pool? Is it added as storage in Datecenter -> Storage?
 
it's added as local-backup storage yes. (VZDump backup file)
 
Remove/Disable it and reboot the node afterwards.
 
Ok I will try that.

Assuming I manage to export the pool, I understand from the manpage that zpool import will want to use a new pool name. I'd prefer using the same old - is that possible? How? Once the pool is exported, can the old pool be deleted or something?
 
Simply import it with the same name again.
 
You will also need to remove the empty mountpoint folder for that pool or you can't create it again with the same name because the mountpoint is then already in use.
 
sorry to hijack the thread but on my pbs the zfs GUI created pool with /dev/xxx is there a way to convert it to /by/id ? i tried to export but it says the pool cannot be unmounted.
 
You will also need to remove the empty mountpoint folder for that pool or you can't create it again with the same name because the mountpoint is then already in use.
How do you do that? Just like any other folder or is there a zpool command to remove it?
 
How do you do that? Just like any other folder or is there a zpool command to remove it?
Just like any other folder. But make sure the pool is really exported so you don't delete stuff on your pool.
 
Just like any other folder. But make sure the pool is really exported so you don't delete stuff on your pool.
And how do you do that, just a standard 'ls -alR' or 'find' showing nothing, or is there some zpool export-check command?
 
The pools mountpoint is usually "/YourPoolName". After exporting the pool should be missing in zpool status. You can then check if that folder is empty and if it is remove it with the rm command.
 
  • Like
Reactions: rcd and mira
Still can't export the pool, keep getting the same cannot export 'poolz: pool is busy"

So, under Datacenter -> Storage I have 3 entries:

1643991815669.png

It turns out all of those hook into /poolz, so I disabled all 3 and rebooted.

When the server came back the pool was gone.

Code:
# zpool list
no pools available
# zpool export poolz
cannot open 'poolz': no such pool

If I enable anyone of the 3 above, the pool magically pops up, but immediately gets "busy".

Code:
# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
poolz  18.2T  11.6T  6.59T        -         -    12%    63%  1.00x    ONLINE  -
# zpool export poolz
cannot export 'poolz': pool is busy

fuser | grep poolz also comes up blank...
 
Last edited:
Actually, isn't the pool already using by-id ?

Code:
        NAME                        STATE     READ WRITE CKSUM
        poolz                       ONLINE       0     0     0
          raidz1-0                  ONLINE       0     0     0
            wwn-0x50014ee20fb7a683  ONLINE       0     0     0
            wwn-0x5000c500c5097235  ONLINE       0     0     0
            wwn-0x5000c500c5060646  ONLINE       0     0     0
            wwn-0x5000c500c50451ee  ONLINE       0     0     0
            wwn-0x5000c500c504134c  ONLINE       0     0     0

These are the only entries I have under /dev/disk/by-id anyway. So why was a USB drive able to kick one of the pool drives offline?
 
Actually, isn't the pool already using by-id ?

Code:
        NAME                        STATE     READ WRITE CKSUM
        poolz                       ONLINE       0     0     0
          raidz1-0                  ONLINE       0     0     0
            wwn-0x50014ee20fb7a683  ONLINE       0     0     0
            wwn-0x5000c500c5097235  ONLINE       0     0     0
            wwn-0x5000c500c5060646  ONLINE       0     0     0
            wwn-0x5000c500c50451ee  ONLINE       0     0     0
            wwn-0x5000c500c504134c  ONLINE       0     0     0

These are the only entries I have under /dev/disk/by-id anyway. So why was a USB drive able to kick one of the pool drives offline?
Jup, wwn are unique IDs. And ZFS is only using these when creating the pool or replacing disks. For normal operation ZFS isn't using these as ZFS stores disk information as metadata on the disk itself and uses that for identification.
 
Last edited:
Right, but what happened was the server was rebooted and a USB backup drive that normally uses /dev/sdg suddenly decided to use /dev/sdc instead, which caused one of the zraid drives to disappear from the pool, and so on and so forth.

How could that happen and how do I avoid it happening again? Any idea?
 

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!