[SOLVED] ZFS: Changing label after replacing harddisk?

bowman

New Member
Nov 23, 2016
5
0
1
56
Hi,

after a harddisk-failure i replaced the disk in a zfs-pool and resilvered it (everything is working fine so far). Unfortunately, i choose the device notation for the replacement-harddisk (/dev/sda) and not the ID (containing the serial number) and now the pool looks like this:

Code:
    NAME                                          STATE     READ WRITE CKSUM
    local-pool                                    ONLINE       0     0     0
      mirror-0                                    ONLINE       0     0     0
        sda                                       ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0N10NER  ONLINE       0     0     0
      mirror-1                                    ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N6JNVNX4  ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N6CYKSR1  ONLINE       0     0     0

Is there a simple way to replace the 'sda' with the ID of the replacement-harddisk? the only way i figured out that might (?) work is this:

Code:
zpool detach local-pool /dev/sda

Code:
zpool attach -f local-pool /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N4JNCD8E /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0N10NER

I'd like to avoid another full resilvering (or a complete rebuild of the pool from the backup), so i better ask first... ;-)
 
...i tried, but it seems a bit complicated to me: It would require to export the pool first, then to rename it, then to import it as you suggested and then to rename it again. The Problem: The pool is busy and therefore refuses to export. I guess i'd have to shut downs all VM's and to remove the pool from Proxmox - and i'm not shure how to reattach it properly to avoid loosing the VM-Configurations...
 
It is enough to export and import. It does not request to rename or shutdown system nor you loose your VM configurations. If your system is running you don`t need to worry. Export and import the pool after next system reboot.
 
...hmmm: I switched off the autostart of the VM's and rebooted the host: I can export the pool now, but when i try to import it with

Code:
zpool import -d /dev/disk/by-id/ local-pool

it says
Code:
cannot import 'local-pool': a pool with that name already exists
use the form 'zpool import <pool | id> <newpool>' to give it a new name

I guess it would work if i give it a new name (say 'local-pool2'), but then i will have to rename it back to 'local-pool' to match the VM-configuration, right? (...i'm quite new to ZFS and Proxmox, sorry for the annoying questions... ;-) I just want to avoid risks because i don't have a 2nd system for testing here... ;-)
 
...oh wait! Just after doing the export and a reboot everything is fine now:

Code:
    NAME                                          STATE     READ WRITE CKSUM
    local-pool                                    ONLINE       0     0     0
      mirror-0                                    ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N4JNCD8E  ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0N10NER  ONLINE       0     0     0
      mirror-1                                    ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N6JNVNX4  ONLINE       0     0     0
        ata-WDC_WD30EFRX-68EUZN0_WD-WCC4N6CYKSR1  ONLINE       0     0     0

I have no idea why (the import seems to have been refused), i just did the export... :rolleyes:

Anyhow, thanks a lot! :)
 
Code:
zpool import -d /dev/disk/by-id/ local-pool

it says
Code:
cannot import 'local-pool': a pool with that name already exists
use the form 'zpool import <pool | id> <newpool>' to give it a new name

To finish this thread I can say that this zpool message you can see only if the pool with name 'local-pool' has been imported already.
#zpool list - can show you it.
 
Don't mean to resurrect this old thread, I thought to share a possible solution from another post here. It might be a similar problem where the disk "label" is missing and/or false disk degraded pool message (but disk checks fine with smartctl)

https://forum.proxmox.com/threads/faulty-disk-or-false-zfs.26956/

Basically he took the GUID of the affected disk and replaced it with itself (using dev-by-id)

(per the post above, the command would have looked like this)

zpool replace -f rpool /dev/GUIDof"SDA" /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-WMC4N0N10NER

For those new to proxmox, you can find GUID using "zbl" command or
blkid (where the GUID is listed under “UUID_SUB=xxxxx”

(They mention to wait until resilver is done before rebooting)

cheers!
 
Last edited:

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!