Anyway to change pool to use the gpt label instead of gptid?

Jeremy Chadwick freebsd at jdc.parodius.com
Mon Oct 24 01:14:29 UTC 2011


On Sun, Oct 23, 2011 at 07:52:08PM -0500, Larry Rosenman wrote:
> Is there any way to convert this setup to use the GPT labels instead
> of the the GPT UUID's in zpool status/zpool iostat?
> 
> $ gpart show
> 
> =>       34  781422701  ada0  GPT  (372G)
>          34          2        - free -  (1.0k)
>          36        128     1  freebsd-boot  (64k)
>         164    8388608     2  freebsd-swap  (4.0G)
>     8388772  773033963     3  freebsd-zfs  (368G)
> 
> =>       34  781422701  ada1  GPT  (372G)
>          34          2        - free -  (1.0k)
>          36        128     1  freebsd-boot  (64k)
>         164    8388608     2  freebsd-swap  (4.0G)
>     8388772  773033963     3  freebsd-zfs  (368G)
> 
> =>       34  976773101  ada2  GPT  (465G)
>          34          2        - free -  (1.0k)
>          36        128     1  freebsd-boot  (64k)
>         164    8388608     2  freebsd-swap  (4.0G)
>     8388772  968384363     3  freebsd-zfs  (461G)
> 
> =>       34  781422701  ada3  GPT  (372G)
>          34          2        - free -  (1.0k)
>          36        128     1  freebsd-boot  (64k)
>         164    8388608     2  freebsd-swap  (4.0G)
>     8388772  773033963     3  freebsd-zfs  (368G)
> 
> =>       34  781422701  ada4  GPT  (372G)
>          34          2        - free -  (1.0k)
>          36        128     1  freebsd-boot  (64k)
>         164    8388608     2  freebsd-swap  (4.0G)
>     8388772  773033963     3  freebsd-zfs  (368G)
> 
> =>       34  781422701  ada5  GPT  (372G)
>          34          2        - free -  (1.0k)
>          36        128     1  freebsd-boot  (64k)
>         164    8388608     2  freebsd-swap  (4.0G)
>     8388772  773033963     3  freebsd-zfs  (368G)
> $ gpart list
> 
> Geom name: ada0
> modified: false
> state: OK
> fwheads: 16
> fwsectors: 63
> last: 781422734
> first: 34
> entries: 128
> scheme: GPT
> Providers:
> 1. Name: ada0p1
>    Mediasize: 65536 (64k)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 18432
>    Mode: r0w0e0
>    rawuuid: bc4c1c42-f17f-11e0-a060-0030488e9ff3
>    rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
>    label: (null)
>    length: 65536
>    offset: 18432
>    type: freebsd-boot
>    index: 1
>    end: 163
>    start: 36
> 2. Name: ada0p2
>    Mediasize: 4294967296 (4.0G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e1
>    rawuuid: ca30afcf-f17f-11e0-a060-0030488e9ff3
>    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
>    label: swap0
>    length: 4294967296
>    offset: 83968
>    type: freebsd-swap
>    index: 2
>    end: 8388771
>    start: 164
> 3. Name: ada0p3
>    Mediasize: 395793389056 (368G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e2
>    rawuuid: dab78d7a-f17f-11e0-a060-0030488e9ff3
>    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
>    label: disk0
>    length: 395793389056
>    offset: 4295051264
>    type: freebsd-zfs
>    index: 3
>    end: 781422734
>    start: 8388772
> Consumers:
> 1. Name: ada0
>    Mediasize: 400088457216 (372G)
>    Sectorsize: 512
>    Mode: r2w2e5
> 
> Geom name: ada1
> modified: false
> state: OK
> fwheads: 16
> fwsectors: 63
> last: 781422734
> first: 34
> entries: 128
> scheme: GPT
> Providers:
> 1. Name: ada1p1
>    Mediasize: 65536 (64k)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 18432
>    Mode: r0w0e0
>    rawuuid: 54e701ff-f180-11e0-a060-0030488e9ff3
>    rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
>    label: (null)
>    length: 65536
>    offset: 18432
>    type: freebsd-boot
>    index: 1
>    end: 163
>    start: 36
> 2. Name: ada1p2
>    Mediasize: 4294967296 (4.0G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e1
>    rawuuid: 54eebd95-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
>    label: swap1
>    length: 4294967296
>    offset: 83968
>    type: freebsd-swap
>    index: 2
>    end: 8388771
>    start: 164
> 3. Name: ada1p3
>    Mediasize: 395793389056 (368G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e2
>    rawuuid: 54f70329-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
>    label: disk1
>    length: 395793389056
>    offset: 4295051264
>    type: freebsd-zfs
>    index: 3
>    end: 781422734
>    start: 8388772
> Consumers:
> 1. Name: ada1
>    Mediasize: 400088457216 (372G)
>    Sectorsize: 512
>    Mode: r2w2e5
> 
> Geom name: ada2
> modified: false
> state: OK
> fwheads: 16
> fwsectors: 63
> last: 976773134
> first: 34
> entries: 128
> scheme: GPT
> Providers:
> 1. Name: ada2p1
>    Mediasize: 65536 (64k)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 18432
>    Mode: r0w0e0
>    rawuuid: 550e22c7-f180-11e0-a060-0030488e9ff3
>    rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
>    label: (null)
>    length: 65536
>    offset: 18432
>    type: freebsd-boot
>    index: 1
>    end: 163
>    start: 36
> 2. Name: ada2p2
>    Mediasize: 4294967296 (4.0G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e1
>    rawuuid: 5515f1c4-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
>    label: swap2
>    length: 4294967296
>    offset: 83968
>    type: freebsd-swap
>    index: 2
>    end: 8388771
>    start: 164
> 3. Name: ada2p3
>    Mediasize: 495812793856 (461G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e2
>    rawuuid: 551f4215-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
>    label: disk2
>    length: 495812793856
>    offset: 4295051264
>    type: freebsd-zfs
>    index: 3
>    end: 976773134
>    start: 8388772
> Consumers:
> 1. Name: ada2
>    Mediasize: 500107862016 (465G)
>    Sectorsize: 512
>    Mode: r2w2e5
> 
> Geom name: ada3
> modified: false
> state: OK
> fwheads: 16
> fwsectors: 63
> last: 781422734
> first: 34
> entries: 128
> scheme: GPT
> Providers:
> 1. Name: ada3p1
>    Mediasize: 65536 (64k)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 18432
>    Mode: r0w0e0
>    rawuuid: 553d6d5f-f180-11e0-a060-0030488e9ff3
>    rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
>    label: (null)
>    length: 65536
>    offset: 18432
>    type: freebsd-boot
>    index: 1
>    end: 163
>    start: 36
> 2. Name: ada3p2
>    Mediasize: 4294967296 (4.0G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e1
>    rawuuid: 554677f6-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
>    label: swap3
>    length: 4294967296
>    offset: 83968
>    type: freebsd-swap
>    index: 2
>    end: 8388771
>    start: 164
> 3. Name: ada3p3
>    Mediasize: 395793389056 (368G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e2
>    rawuuid: 554fbc57-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
>    label: disk3
>    length: 395793389056
>    offset: 4295051264
>    type: freebsd-zfs
>    index: 3
>    end: 781422734
>    start: 8388772
> Consumers:
> 1. Name: ada3
>    Mediasize: 400088457216 (372G)
>    Sectorsize: 512
>    Mode: r2w2e5
> 
> Geom name: ada4
> modified: false
> state: OK
> fwheads: 16
> fwsectors: 63
> last: 781422734
> first: 34
> entries: 128
> scheme: GPT
> Providers:
> 1. Name: ada4p1
>    Mediasize: 65536 (64k)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 18432
>    Mode: r0w0e0
>    rawuuid: 556c3554-f180-11e0-a060-0030488e9ff3
>    rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
>    label: (null)
>    length: 65536
>    offset: 18432
>    type: freebsd-boot
>    index: 1
>    end: 163
>    start: 36
> 2. Name: ada4p2
>    Mediasize: 4294967296 (4.0G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e1
>    rawuuid: 55754618-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
>    label: swap4
>    length: 4294967296
>    offset: 83968
>    type: freebsd-swap
>    index: 2
>    end: 8388771
>    start: 164
> 3. Name: ada4p3
>    Mediasize: 395793389056 (368G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e2
>    rawuuid: 557e84df-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
>    label: disk4
>    length: 395793389056
>    offset: 4295051264
>    type: freebsd-zfs
>    index: 3
>    end: 781422734
>    start: 8388772
> Consumers:
> 1. Name: ada4
>    Mediasize: 400088457216 (372G)
>    Sectorsize: 512
>    Mode: r2w2e5
> 
> Geom name: ada5
> modified: false
> state: OK
> fwheads: 16
> fwsectors: 63
> last: 781422734
> first: 34
> entries: 128
> scheme: GPT
> Providers:
> 1. Name: ada5p1
>    Mediasize: 65536 (64k)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 18432
>    Mode: r0w0e0
>    rawuuid: 5598ebf4-f180-11e0-a060-0030488e9ff3
>    rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
>    label: (null)
>    length: 65536
>    offset: 18432
>    type: freebsd-boot
>    index: 1
>    end: 163
>    start: 36
> 2. Name: ada5p2
>    Mediasize: 4294967296 (4.0G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e1
>    rawuuid: 55a1f6a0-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
>    label: swap5
>    length: 4294967296
>    offset: 83968
>    type: freebsd-swap
>    index: 2
>    end: 8388771
>    start: 164
> 3. Name: ada5p3
>    Mediasize: 395793389056 (368G)
>    Sectorsize: 512
>    Stripesize: 0
>    Stripeoffset: 83968
>    Mode: r1w1e2
>    rawuuid: 55ab4aad-f180-11e0-a060-0030488e9ff3
>    rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
>    label: disk5
>    length: 395793389056
>    offset: 4295051264
>    type: freebsd-zfs
>    index: 3
>    end: 781422734
>    start: 8388772
> Consumers:
> 1. Name: ada5
>    Mediasize: 400088457216 (372G)
>    Sectorsize: 512
>    Mode: r2w2e5
> $ zpool status
> 
>   pool: zroot
>  state: ONLINE
>  scan: scrub repaired 0 in 0h16m with 0 errors on Thu Oct 13 22:55:43 2011
> config:
> 
> 	NAME                                            STATE     READ WRITE CKSUM
> 	zroot                                           ONLINE       0     0     0
> 	  raidz1-0                                      ONLINE       0     0     0
> 	    gptid/dab78d7a-f17f-11e0-a060-0030488e9ff3  ONLINE       0     0     0
> 	    gptid/54f70329-f180-11e0-a060-0030488e9ff3  ONLINE       0     0     0
> 	    gptid/551f4215-f180-11e0-a060-0030488e9ff3  ONLINE       0     0     0
> 	    gptid/554fbc57-f180-11e0-a060-0030488e9ff3  ONLINE       0     0     0
> 	    gptid/557e84df-f180-11e0-a060-0030488e9ff3  ONLINE       0     0     0
> 	    gptid/55ab4aad-f180-11e0-a060-0030488e9ff3  ONLINE       0     0     0
> 
> errors: No known data errors
> 
> $
> 
> Thanks for any help!



Aren't GPT labels stored in the /dev/gpt directory structure?

If so, try maybe one of these two:

zpool replace zroot gptid/55ab4aad-f180-11e0-a060-0030488e9ff3 /dev/gpt/disk5
zpool replace -f zroot gptid/55ab4aad-f180-11e0-a060-0030488e9ff3 /dev/gpt/disk5

You might also try offlining the "gptid/XXX" entry first, then try a
normal replace.

After doing this (on each and every device -- your pool will need to
resilver too, every time), I imagine you will need to disable GPT IDs
entirely using a loader.conf variable (see this thread, read the full
thing):

http://lists.freebsd.org/pipermail/freebsd-stable/2011-June/062999.html

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                   Mountain View, CA, US |
| Making life hard for others since 1977.               PGP 4BD6C0CB |



More information about the freebsd-fs mailing list