Oct 152019
 

In my recent post you saw this:

[dan@r720-01 ~]$ zpool status zroot
  pool: zroot
 state: ONLINE
  scan: resilvered 818M in 0 days 00:00:09 with 0 errors on Tue Oct 15 21:32:12 2019
config:

	NAME          STATE     READ WRITE CKSUM
	zroot         ONLINE       0     0     0
	  mirror-0    ONLINE       0     0     0
	    ada0p3    ONLINE       0     0     0
	    gpt/zfs1  ONLINE       0     0     0

errors: No known data errors
[dan@r720-01 ~]$ 

I want to change ada0p3 to gpt/zfs0, as shown in this set of labels:

[dan@r720-01 ~]$ gpart show -l ada0 ada1
=>       40  156301408  ada0  GPT  (75G)
         40       1024     1  gptboot0  (512K)
       1064        984        - free -  (492K)
       2048    4194304     2  swap0  (2.0G)
    4196352  152104960     3  zfs0  (73G)
  156301312        136        - free -  (68K)

=>       40  156301408  ada1  GPT  (75G)
         40       1024     1  gptboot1  (512K)
       1064        984        - free -  (492K)
       2048    4194304     2  swap1  (2.0G)
    4196352  152104960     3  zfs1  (73G)
  156301312        136        - free -  (68K)

[dan@r720-01 ~]$ 

This is purely cosmetic.

detach

NOTE! This is a mirror. We must use detach and attach. Remember that. If you don’t do attach, you will end up with a stripe, not a mirror. You probably don’t want that.

[dan@r720-01 ~]$ sudo zpool detach zroot ada0p3

I should have done a status there, but I didn’t.

attach

We must do an attach, to create a mirror.

[dan@r720-01 ~]$ sudo zpool attach zroot /dev/gpt/zfs1 /dev/gpt/zfs0
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'zroot', you may need to update
boot code on newly attached disk '/dev/gpt/zfs0'.

Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:

	gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

[dan@r720-01 ~]$ 

In this case, we do not have to do that bootcode command because we know we have done that.

status

The status immediately after is:

[dan@r720-01 ~]$ zpool status zroot
  pool: zroot
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
	continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Tue Oct 15 22:04:26 2019
	819M scanned at 273M/s, 231M issued at 77.1M/s, 819M total
	223M resilvered, 28.25% done, 0 days 00:00:07 to go
config:

	NAME          STATE     READ WRITE CKSUM
	zroot         ONLINE       0     0     0
	  mirror-0    ONLINE       0     0     0
	    gpt/zfs1  ONLINE       0     0     0
	    gpt/zfs0  ONLINE       0     0     0

errors: No known data errors

Good. This is what we want.

3 seconds later, it was done.

But want, there’s more!

Now the drives are in the wrong order! I want zfs0/zfs1.

This is entirely cosmetic and makes no difference to the system at all.

Let’s try this again, removing the other drive:

[dan@r720-01 ~]$ sudo zpool detach zroot gpt/zfs1
[dan@r720-01 ~]$ zpool status zroot
  pool: zroot
 state: ONLINE
  scan: resilvered 819M in 0 days 00:00:10 with 0 errors on Tue Oct 15 22:04:36 2019
config:

	NAME        STATE     READ WRITE CKSUM
	zroot       ONLINE       0     0     0
	  gpt/zfs0  ONLINE       0     0     0

errors: No known data errors
[dan@r720-01 ~]$ sudo zpool attach zroot /dev/gpt/zfs0 /dev/gpt/zfs1
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'zroot', you may need to update
boot code on newly attached disk '/dev/gpt/zfs1'.

Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:

	gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

[dan@r720-01 ~]$ zpool status zroot
  pool: zroot
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
	continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Tue Oct 15 22:11:33 2019
	819M scanned at 409M/s, 178M issued at 89.1M/s, 819M total
	170M resilvered, 21.74% done, 0 days 00:00:07 to go
config:

	NAME          STATE     READ WRITE CKSUM
	zroot         ONLINE       0     0     0
	  mirror-0    ONLINE       0     0     0
	    gpt/zfs0  ONLINE       0     0     0
	    gpt/zfs1  ONLINE       0     0     0

errors: No known data errors
[dan@r720-01 ~]$ 

There! Done.

Thank you for flying Air Cosmetic.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive