Clone zfs pool and use new cloned pool

i need to migrate my used zfs pool (ashift=9) to a new zfs pool (ashift=12)

Background:
used zfs pool is ashift 9 (mirrored 2 drives)
drive 2 in the pool faulted and replaced with new one
drive 2 now defaults to 4kB sectors
zpool attach needs ashift=9 to mirror zfs again (drive 2 is attached in pool for mirror)

i want to change ashift to 12 for used lxd zfs storage.

what steps are needed to migrate the zfs pool to ashift=12?

i think this way will be right?

  1. detach one drive from mirror zfs pool
  2. create new ashift=12 pool from detached drive
  3. copy storage vom old ashift=9 to new ashift=12 (how to copy and migrate in lxd?)
  4. destroy old ashift=9 pool and attach this drive to ashift=12 pool for mirror

thanks

You should be able to do this without any LXD interaction by using zfs send/receive to copy your data from the old zpool to the new one. Once everything’s been transferred and looks identical, you can delete the old pool, move the second drive into the new one and then rename the new pool to the old one’s name.

The lxd containers inside the zfs storage pool are adjusted to new pool by hand? (in case of zfs send)

Would “lxc move” command the better alternative?

my steps to migrate into new zfs pool:

# /dev/sdb === old drive 512Byte sector size
# /dev/sdc === new drive 4kByte sector size
# zfsstorage - old zfs storage pool mirror sdb+sdc ashift=9
# zfstank - new zfs storage (ashift=12)
# zfsmirror - for zfstank in lxc
zpool detach zfsstorage sdb
zpool create -f zfstank -o ashift=12 /dev/sdb
lxc storage create zfsmirror zfs source=zfstank
lxc stop CONTAINER
lxc move CONTAINER moveCONTAINER -s zfsmirror
lxc rename moveCONTAINER CONTAINER
lxc start CONTAINER

Now i need to move the last profile enty to new zfsmirror storage.
How is this to be done?

root@Ubuntu-1804-bionic-64-minimal ~ # lxc storage list
+-----------+-------------+--------+------------+---------+
|   NAME    | DESCRIPTION | DRIVER |   SOURCE   | USED BY |
+-----------+-------------+--------+------------+---------+
| default   |             | zfs    | zfsstorage | 1       |
+-----------+-------------+--------+------------+---------+
| zfsmirror |             | zfs    | zfstank    | 14      |
+-----------+-------------+--------+------------+---------+
root@Ubuntu-1804-bionic-64-minimal ~ # lxc storage show default
config:
  source: zfsstorage
  volatile.initial_source: zfsstorage
  zfs.pool_name: zfsstorage
description: ""
name: default
driver: zfs
used_by:
- /1.0/profiles/default
status: Created
locations:
- none
root@Ubuntu-1804-bionic-64-minimal ~ # lxc profile show default
config: {}
description: Default LXD profile
devices:
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
------------------------------