Expand and Replace disk ZFS on Proxmox

I have 2 disk in Proxmox lab that configured with RAID 1
sda = 20GB
sdb = 20GB
It have total capacity 20GB

I will increase the disk size to be 30GB. So that, I insert 2 new disks
sdc = 30GB
sdd = 30GB
It will have total capacity 30GB

Below is the steps that will be done on this task

  1. Replace sdb with sdc
  2. Replace sda with sdd
  3. fdisk /dev/sdc and /dev/sdd to expand the disk
  4. Expand zfs on rpool
  5. Detach old disks from server
Current rpool status
# zpool status
pool: rpool
state: ONLINE
scan: resilvered 900M in 0h12m with 0 errors on Fri Jun 7 15:35:41 2019
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sda3 ONLINE 0 0 0
sdb3 ONLINE 0 0 0

1. Replace sdb with sdc

sgdisk -R /dev/sdc /dev/sda             (sgdisk -R /dev/newdisk /dev/olddisk)

sgdisk -G /dev/sdc                      (sgdisk -G /dev/newdisk)

grub-install /dev/sdc                   (grub install)

zpool replace rpool /dev/sdb3 /dev/sdc3 (replace the disk)

Waiting the resilvering process until it done. After that, continue to replace disk on sda

2. Replace sda with sdd

sgdisk -R /dev/sdd /dev/sdc
sgdisk -G /dev/sdd
grub-install /dev/sdd
zpool replace rpool /dev/sda3 /dev/sdd3
Waiting the resilvering process until it done.

3. fdisk /dev/sdc and /dev/sdd to expand the disk

fdisk /dev/sdc:

Current disk layout :
Device Start End Sectors Size Type
/dev/sdc1 34 2047 2014 1007K BIOS boot
/dev/sdc2 2048 1050623 1048576 512M EFI System
/dev/sdc3 1050624 41943006 40892383 19.5G Solaris /usr & Apple ZFS
Choose d (delete the last partition partitin 03)
Choose n (create new partion for partition 03)
Do you want to remove the signature? [Y]es/[N]o: N (Type N to avoid any disk corruption)
Choose t then Type 48 for Solaris /usr & Apple ZFS partition type
Choose w (to write the new partition)

Disk layout after expand the disk:
Device Start End Sectors Size Type
/dev/sdc1 34 2047 2014 1007K BIOS boot
/dev/sdc2 2048 1050623 1048576 512M EFI System
/dev/sdc3 1050624 62914526 61863903 29.5G Solaris /usr & Apple ZFS

fdisk /dev/sdd: Do the same above steps to expand /dev/sdd

partprobe (to detect new disk layout)

4. Expand zfs on rpool

zpool set autoexpand=on rpool
zpool online -e rpool /dev/sdc3
zpool online -e rpool /dev/sdd3
zpool set autoexpand=off rpool

root@prox3:~# zpool status
pool: rpool
state: ONLINE
scan: resilvered 900M in 0h12m with 0 errors on Fri Jun 7 15:35:41 2019
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sdb3 ONLINE 0 0 0
sdc3 ONLINE 0 0 0

5. Detach the Old disks from the server. After that, restart the server.
The disk layout will change as follow

root@prox3:~# zpool status
pool: rpool
state: ONLINE
scan: resilvered 900M in 0h12m with 0 errors on Fri Jun 7 15:35:41 2019
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sda3 ONLINE 0 0 0
sdb3 ONLINE 0 0 0

Tinggalkan komentar

Situs ini menggunakan Akismet untuk mengurangi spam. Pelajari bagaimana data komentar Anda diproses.