ZFS Question: How can I fix the gptid on a vdev

NASbox

Guru
Joined
May 8, 2012
Messages
650
I have a backup script that automatically mounts a single vdev (disk) pool. To do this, it is dependent upon zpool import having a gptid for the device. I was careless and did not properly unmount a backup pool, and something happend to the gptid.

Before improper unmount:
Code:
#>zpool import
   pool: BACKUP02
     id: 1487853121776782679
  state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

        BACKUP02                                      ONLINE
          gptid/735dxxxx-xxxx-xxxx-xxxx-xxxx17d2xxxx  ONLINE

After improper mount:
Code:
#>zpool import
   pool: BACKUP02
     id: 1487853121776782679
  state: ONLINE
status: Some supported features are not enabled on the pool.
action: The pool can be imported using its name or numeric identifier, though
        some features will not be available without an explicit 'zpool upgrade'.
config:

        BACKUP02    ONLINE
          ada3p2    ONLINE

I have checked that this has nothing to do with the pool not being upgraded. I have another backup pool that was created in exactly the same way but was not improperly handled, and it is still displaying a gptid.

glabel status still shows the gptid:
Code:
                                      Name  Status  Components
gptid/735dxxxx-xxxx-xxxx-xxxx-xxxx17d2xxxx     N/A  ada3p2

and zfs list shows the pool name correctly and all the snapshots.

If I manually mount the pool from the command line using zpool import BACKUP02, I can still access the data, so other than the gptid not showing up correctly in the import command (and also zpool status when mounted), everything is OK.

How can I fix this? (I'm OK with changing to a different gptid if necessary.) I would just rather not have to run the backup again since it contains about 8TB of data and is going to take some time. (Iit will also require a current pool, and I'm not ready to commint to 11.2-U7 just yet.)
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
You may try to add `-d /dev/gptid` to `zpool import` command. It should make ZFS to look for its disks only among those devices. After first such import it should remember devices it found and use them. By default ZFS tries to use device names it used before, searching for other options only if previous are not usable.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
You may try to add `-d /dev/gptid` to `zpool import` command. It should make ZFS to look for its disks only among those devices. After first such import it should remember devices it found and use them. By default ZFS tries to use device names it used before, searching for other options only if previous are not usable.
Thanks @mav@ - Here is what I did:
  1. Loaded the drive ada3 and let it spin upit up
  2. glabel status to verify pool is ada3p2 as above
  3. ran the zpool import -d command (non-redacted without xxxx's)
Code:
#>zpool import -d /dev/gptid/gptid/735dxxxx-xxxx-xxxx-xxxx-xxxx17d2xxxx
cannot open '/dev/gptid/735dxxxx-xxxx-xxxx-xxxx-xxxx17d2xxxx/': Not a directory

Based on this:
Code:
#>ls -la /dev
total 13
...
crw-r-----   1 root  operator  0x66 Dec 11 15:28 ada3
crw-r-----   1 root  operator  0x67 Dec 11 15:28 ada3p2
...
I also tried:
Code:
#>zpool import -d /dev/ada3
cannot open '/dev/ada3/': Not a directory
#>zpool import -d /dev/ada3p
cannot open '/dev/ada3p': must be an absolute path
and neither of those worked either.
Any other suggestions?
 
Last edited:

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
You don't need to specify whole gptid in the command. Just directory and a pool name should work.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Plus `/dev/gptid/gptid` is obviously wrong.
Yup, I retried it just to be sure - I made a mistake when I redacted the gptid.
You don't need to specify whole gptid in the command. Just directory and a pool name should work.
Not exactly sure what you are getting at. Yes, I know that zpool import BACKUP02 will import the pool - that is not the issue.
The issue is that I need to get zpool import and zpool status to report the gptid that is reported by glabel status so that my script can identify the pool of the disk that is mounted at /dev/ada3. An incorrect unmount caused something to happen so that the gptid is no longer reported by th zpool command.

So, I need a way to recreate the gptid so it gets reported properly (either with the same gptid, or a different one - doesn't matter - the only thing that matters is glabel status and zpool import both show the same gptid - even ada3p2 for both would likely be OK.)

Alternatively, it would be even better to have a way to automatically identify the name of the pool on the disk mounted at ada3 without having to use the gptid, but AFAIK there is no command that will do that.
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
Could you run `ls /dev/gptid` to see that respective one is there? After that could you run `zpool import -d /dev/gptid BACKUP02` and show what it tells?

gptid's are read from the GPT partition table. There is no way for something to happen to them while GPT partitions themselves exist. GEOM may hide some of alternative providers for the same instance when one of them is open for writing, so you can check whether anything may already have ada3p2 opened. You may try to reboot just to be sure.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Could you run `ls /dev/gptid` to see that respective one is there? After that could you run `zpool import -d /dev/gptid BACKUP02` and show what it tells?

gptid's are read from the GPT partition table. There is no way for something to happen to them while GPT partitions themselves exist. GEOM may hide some of alternative providers for the same instance when one of them is open for writing, so you can check whether anything may already have ada3p2 opened. You may try to reboot just to be sure.
I tried doing a reboot which had no effect. Also tried zpool reguid BACKUP02 - It changed the gptid but didn't solve the problem.

I also did a glable list, an here is the relevent output. I don't see anything significantly different from all the other devices that are identifying themselves correctly.
Code:
Geom name: ada3p2
Providers:
1. Name: gptid/735dxxxx-xxxx-xxxx-xxxx-xxxx17d2677a
   Mediasize: 9998683774976 (9.1T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 19528679248
   length: 9998683774976
   index: 0
Consumers:
1. Name: ada3p2
   Mediasize: 9998683774976 (9.1T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
I don't know if this is significant or provides a clue, but when I zpool import BACKUP02, the pool imports fine and the data is accessable, but the device no longer shows up in glabel status or /dev/gptid.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Any suggestions?
 
Top