Skip to content

Expand iSCSI Based ZFS Filesystem

Purpose: The purpose of this workflow is to illustrate the process of expanding storage for a Linux server that uses an iSCSI-based ZFS storage. We want the VM to have more storage space, so this document will go over the steps to expand that usable space.

Assumptions

It is assumed you are using an Ubuntu based operating system, as these commands may not be the same on other distributions of Linux.

This document also assumes you did not enable Logical Volume Management (LVM) when deploying your server. If you did, you will need to perform additional LVM-specific steps after increasing the space.

Increase iSCSI Disk Size

This part should be fairly straight-forward. Using whatever hypervisor / storage appliance hosting the iSCSI target, expand the disk space of the LUN to the desired size.

Extend ZFS Pool

This step goes over how to increase the usable space of the ZFS pool within the server itself after it was expanded.

iscsiadm -m session --rescan # (1)
lsblk  # (2)
parted /dev/sdX # (3)
unit TB # (4)
resizepart X XXTB # (5)
zpool list # (6)
zpool online -e <POOL-NAME> /dev/sdX # (7)
zpool scrub <POOL-NAME> # (8)
  1. Re-scan iSCSI targets for changes.
  2. Leverage lsblk to ensure that the storage size increase from the hypervisor / storage appliance reflects correctly.
  3. Open partitioning utility on the ZFS volume / LUN / iSCSI disk. Replace dev/sdX with the actual device name.
  4. Self-explanatory storage measurement.
  5. Resizes whatever partition is given to fit the new storage capacity. Replace X with the partition number. Replace XXTB with a valid value, such as 10TB.
  6. This will allow you to list all ZFS pools that are available for the next command.
  7. Brings the ZFS Pool back online. Replace <POOL-NAME> with the actual name of the ZFS pool.
  8. This tells the system to scan the ZFS pool for any errors or corruption and correct them. Think of it as a form of housekeeping.

Check on Scrubbing Progress

At this point, the ZFS pool has been expanded and a scrub task has been started. The scrubbing task can take several hours / days to run, so to keep track of it, you can run the following command to check the status of the ZFS pool / scrubbing task.

zpool status