Resize ROOT zfs partition smaller

moxmox

Well-Known Member
Aug 14, 2019
63
8
48
44
Hi,

I have 2 ssds in a zfs mirror 500gb for my rpool. One disk failed recently (consumer cosair - only lasted about 5 months) I bought two enterprise ssds to replace the failed one. These are only 480gb (didn't check when ordering so my fault!)

Ideally I do not want to have to reinstall as its a live server. Is it possible to resize the rpool down by 30gb? There is plenty of free space. I am happy to use gparted or clonezilla as have used them in the past in this situation just never done on it on zfs and not sure if shriking zfs is even possible? I have googled and found quite a bit of conflicting information so wanted to co check here.

thanks!

rpool detail

Code:
root@pve:~# zpool status rpool
  pool: rpool
 state: ONLINE
  scan: resilvered 373G in 0 days 02:53:51 with 0 errors on Tue Mar 24 19:42:15 2020
config:

        NAME                                                     STATE     READ WRITE CKSUM
        rpool                                                    ONLINE       0     0     0
          mirror-0                                               ONLINE       0     0     0
            ata-Samsung_SSD_850_EVO_500GB_S2RBNXBH240712B-part3  ONLINE       0     0     0
            ata-CT500MX500SSD1_1920E2032341-part3                ONLINE       0     0     0

errors: No known data errors
 
NB I have temporarily replaced the failed one with another consumer ssd I had spare but want to replace both with the 480gb enterprise ssds.
 
Not a chance - ZFS will not accept a mirror drive which is significantly smaller than the existing one. It doesn't matter, if there's still space left on the ZPOOL, the ZPOOL parameters can't be changed.

However, you can create a new ZPOOL and zfs send/recv your rpool over - than make that device bootable and then get rid of the old rpool. You will need to boot your server at least once, of course.
 
thanks - managed to hold off doing this until now.

I pretty much know how to do the zpool send recv and how to create a new rpool but can you expand on how I should create the partitions and set it bootable.

looking at the current disk its a gpt table

Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: xxxx

Device Start End Sectors Size Type
/dev/sdi1 34 2047 2014 1007K BIOS boot
/dev/sdi2 2048 1050623 1048576 512M EFI System
/dev/sdi3 1050624 976773134 975722511 465.3G Solaris /usr & Apple ZFS

I assume I cannot just use sgdisk to replicate the parition table as its a slightly smaller disk.

Do I need to create a similar part table on the new disk. but what should I transfer into the bios boot and efi system partitions or will grub handle that automatically?

I have tried to find some documentation on this but not been able to.

Any advise would be appreciated.

thanks
 
For anyone else wanting to do this the easiest way I found is to do a fresh install of proxmox on the new disks and then reboot back to the original os and doing zfs send/receive from the old rpool to the new rpool (easier than restoring 30+ backups) you have to rename the new rpool whilst doing it but you can rename it back by booting into the proxmox installer in debug mode.

I did experiment with doing it on the live system by creating the partitions manually and doing zfs send/receive but it was a bit of a pain getting grub setup correctly. (using some of the details in here https://openzfs.github.io/openzfs-docs/Getting Started/Debian/Debian Stretch Root on ZFS.html#step-2-disk-formatting)

So using a fresh install made sure everything was setup correctly on the new disks.

If anyone wants to do the same I can elaborate on what I did.

Its nice you can install proxmox within a vm in proxmox to test this kind of stuff.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!