How can I shrink my zfs-on-root partition for FreeBSD?
Date: Tue, 06 Jan 2026 18:56:53 UTC
Hello! I've had a little mishap The initial situation: I have the following hard drives installed in my PC. 2 TB NVMe (EFI boot partition and the rest Windows) 1 TB NVMe (NTFS formatted, data grave) 2 TB SATA SSD (FreeBSD-ZFS and FreeBSD-Swap) 1 TB SATA SSD (NTFS, games) 500GB SSD (Linux and Windows Games) Windows, FreeBSD and Linux all share the EFI boot partition. Works great so far. I previously had the partition for zfs on 128GB on the 2 TB SATA where I have FreeBSD on it. Since it was getting tight (I still had free space, but 70% full) I thought I'd increase it to 256 or 512. Unfortunately, I forgot the -s option in the gpart resize command and, as you can imagine, FreeBSD grabbed the whole 2TB (except for the few gb from swap). Now I would like to reduce the size again, but that doesn't work quite so easily with ZFS. I've read up on it, but wanted to check again whether these steps are the right ones I've taken. My procedure would look like this: `zfs snap zroot@today` take a snapshot of the pool I would then write the snapshot to a file and compress it with gzip `zfs send -R zroot@today | gzip > /mnt/backup.gz`. Or should I use `zfs send -R -c zroot@today > /mnt/zroot-backup.zfs`? The second one I saw online, but I don't remember where. Reboot into live shell using a boot stick and destroy the pool. `zpool destroy zroot` Delete the partitions using gpart and create a new one (now with the correct size) Create a zfs pool on the newly created partition Create mountpoints Then restore the snapshot of the file `zcat /mnt/backup.gz < zroot@backup` and make a rollback to this snapshot `zfs rollback zroot@backup` Would that work? Or is there something wrong which I don't have in mind? Thanks in advance. -obr