Skip to main content

ZFS

Upgrade single disk rpool to mirrored rpool

I added a second M.2 drive to a laptop already running Proxmox VE. From the zpool-attach man page:

If the existing device is a mirror or plain device (e.g. specified as "sda" or "mirror-7"), the  new device  will  be mirrored with the existing device, a resilver will be initiated, and the new device will contribute to additional redundancy once the resilver completes.

Steps:

  1. Use gdisk or sgdisk to copy the partition table from the existing drive to the new drive and change the GUID.
  2. Make the second disk bootable
  3. Attach the new disk to the existing disk using zpool attach.
# backup partition table from the existing disk nvme0n1
gdisk /dev/nvme0n1
  b
  gdisk.part.nvme0n1
  q

# restore the backed up partition table to the new disk nvme1n1
gdisk /dev/nvme1n1
  r
  l
  gdisk.part.nvme0n1
  x
  g
  R
  w
# same result as using gdisk above
# I have not actually used this method yet
sgdisk --replicate=/dev/nvme1n1 /dev/nvme0n1
sgdisk --randomize-guids /dev/nvme1n1
pve-efiboot-tool status

# Setup the UEFI bootloader
pve-efiboot-tool format /dev/nvme1n1p2 --force  
pve-efiboot-tool init /dev/nvme1n1p2

pve-efiboot-tool status

#
# BEFORE
#
root@pve1:~# zpool status
  pool: rpool
 state: ONLINE
status: Some supported and requested features are not enabled on the pool.
        The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
config:

        NAME                                                           STATE     READ WRITE CKSUM
        rpool                                                          ONLINE       0     0     0
          nvme-BC711_NVMe_SK_hynix_256GB____FYB1N066013901U4N-part3    ONLINE       0     0     0
zpool attach rpool nvme-BC711_NVMe_SK_hynix_256GB____FYB1N066013901U4N-part3 nvme-KBG40ZNS256G_NVMe_KIOXIA_256GB_Y96PC1TDPTLL-part3
#
# AFTER
#
root@pve1:~# zpool status
  pool: rpool
 state: ONLINE
status: Some supported and requested features are not enabled on the pool.
        The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
  scan: resilvered 30.6G in 00:03:12 with 0 errors on Thu Aug  7 16:40:11 2025
config:

        NAME                                                           STATE     READ WRITE CKSUM
        rpool                                                          ONLINE       0     0     0
          mirror-0                                                     ONLINE       0     0     0
            nvme-BC711_NVMe_SK_hynix_256GB____FYB1N066013901U4N-part3  ONLINE       0     0     0
            nvme-KBG40ZNS256G_NVMe_KIOXIA_256GB_Y96PC1TDPTLL-part3     ONLINE       0     0     0

Add SLOG

# identify the disk(s) you want to use
lsblk -o NAME,MODEL,SERIAL,SIZE,TYPE,MOUNTPOINT

# find the disk / partitions by id
find /dev/disk/by-id/ | grep -e VK0240GFDKF -e MTFDDAK960TCB

# add the log mirror
zpool add z-10k-SAS-DS-Mirror log mirror /dev/disk/by-id/ata-VK0240GFDKF_S269NX0H703269-part1 /dev/disk/by-id/ata-MTFDDAK960TCB_18181C3C1F61-part1

# verify
zpool status
# check usage
zpool iostat -v

# watch usage
zpool iostat -v 1
# or
watch zpool iostat -v

Add cache (L2ARC)

zpool add z-10k-SAS-DS-Mirror cache /dev/disk/by-id/ata-MTFDDAK960TCB_18181C3C1F61-part2

 

HPE Proliant