> ## Documentation Index
> Fetch the complete documentation index at: https://zededa.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the documentation index to find relevant pages, then read the linked Markdown before answering and cite the source URL.
> Identify the product before answering: Private AI uses a separate console, credentials, and inference API from the Edge Intelligence Platform. Do not apply instructions from one product to the other.
> Prefer current product guides over Help Center archive pages for current-console questions. Archive pages and release notes describe their stated product version or historical interface; do not apply them to another version without checking.
> Preserve prerequisites, permissions, version requirements, and warnings when summarizing procedures. Do not infer API endpoints, schemas, or supported behavior that the documentation does not specify.

# Expand ZFS Pools on Nodes

> Use the expand_raid0_pool_to_device.sh script to add a disk to the ZFS persist pool on an EVE-OS node configured with raid level none.

## Introduction

This procedure explains how to expand the ZFS persist pool on an EVE-OS node by adding a new or previously unused disk. Use this procedure when a node is running low on pool storage and you have a physical disk available to add.

EVE-OS uses the ZFS storage stack for persistent storage. The ZFS pool size is set at installation time and cannot be increased through Edge Infrastructure Services. To expand the pool, you connect to the node over SSH and run the `expand_raid0_pool_to_device.sh` script, which automates the `zpool add` and `autoexpand` commands.

## Prerequisites

* SSH access to the node. See [Enable and Disable SSH Access for Nodes](https://zededa.mintlify.site/new-ui/infrastructure-services/troubleshooting/enable-disable-ssh.md).
* The node is configured with ZFS raid level `none` (`eve_install_zfs_with_raid_level=none`). This procedure does not apply to nodes configured with raid1, raid5, or raid6.
* EVE-OS 8.11.0 or greater.
* A new disk installed in the node, or a previously unused disk that has not been assigned to any pool.

## SSH into the Node

1. Connect to the node as root:

   ```text theme={"dark"}
   ssh -i YOUR_PRIVATE_KEY_PATH root@DEVICE_IP
   ```

   For example:

   ```text theme={"dark"}
   ssh -i ~/.ssh/id_rsa root@172.16.8.194
   ```

   Example response:

   ```text theme={"dark"}
   EVE is Edge Virtualization Engine
   Take a look around and don't forget to use eve(1).
   862bab0f-a567-4fc2-98b1-c82c77cf74c9:~#
   ```

2. Run `eve enter` to enter the pillar namespace:

   ```text theme={"dark"}
   eve enter
   ```

   Example response:

   ```text theme={"dark"}
   (ns: pillar) 862bab0f-a567-4fc2-98b1-c82c77cf74c9:/#
   ```

3. Before making changes, review the current pool state and size:

   ```text theme={"dark"}
   zpool list
   ```

   Example response:

   ```text theme={"dark"}
   NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
   persist   230G  18.0G   212G        -         -    14%     7%  1.00x    ONLINE  -
   ```

   ```text theme={"dark"}
   zpool status
   ```

   Example response:

   ```text theme={"dark"}
   pool: persist
    state: ONLINE
   config:
   	NAME        STATE     READ WRITE CKSUM
   	persist     ONLINE       0     0     0
   	  sda9      ONLINE       0     0     0
   errors: No known data errors
   ```

## Find the Unused Disk

1. Copy the script content from the [Script Reference](#script-reference) section into a file on the node. The following example uses `vi`:

   ```text theme={"dark"}
   vi /tmp/expand_raid0_pool_to_device.sh
   ```

   Press `i` to enter insert mode, paste the script content, press `Esc`, then type `:wq` to save and exit.

2. Make the script executable:

   ```text theme={"dark"}
   chmod +x /tmp/expand_raid0_pool_to_device.sh
   ```

3. Run the script with the `-d` flag to identify unused disks:

   ```text theme={"dark"}
   /tmp/expand_raid0_pool_to_device.sh -d ()
   ```

   If an unused disk is available, the output shows its device path and size, for example:

   ```text theme={"dark"}
   Found unused: /dev/sdb 58.3G
   ```

   If no unused disk is found, stop here. Verify that the disk is physically installed and recognized by the operating system before continuing.

## Expand the Pool

1. Run the script with the `-e` flag and the device path of the disk you want to add:

   ```text theme={"dark"}
   /tmp/expand_raid0_pool_to_device.sh -e /dev/sdb
   ```

2. When prompted, enter the device path again to confirm:

   ```text theme={"dark"}
   Are you sure you want to expand pool to device /dev/sdb? If so, enter the device path again.
   /dev/sdb
   ```

   A successful expansion returns:

   ```text theme={"dark"}
   Success: expand complete
   ```

3. Exit the pillar namespace and your SSH session:

   ```text theme={"dark"}
   exit
   exit
   ```

## Verify the Expansion

Run `zpool status` and `zpool list` to confirm the disk was added and the pool size increased.

```text theme={"dark"}
zpool status
```

Example response:

```text theme={"dark"}
pool: persist
 state: ONLINE
config:
	NAME        STATE     READ WRITE CKSUM
	persist     ONLINE       0     0     0
	  sda9      ONLINE       0     0     0
	  sdb       ONLINE       0     0     0
errors: No known data errors
```

The new disk appears alongside the existing disk in the pool configuration.

```text theme={"dark"}
zpool list
```

Example response:

```text theme={"dark"}
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
persist   288G  18.0G   270G        -         -    11%     6%  1.00x    ONLINE  -
```

The pool size reflects the combined capacity of both disks.

You can also verify the updated pool size in Edge Infrastructure Services by navigating to the node detail page and checking the **Storage** tab.

## Troubleshoot Disk Wipe Errors

A newly installed disk might have old partition tables or filesystem labels that prevent ZFS from adding it. If the expand command returns an error similar to the following, the disk requires a wipe:

```text theme={"dark"}
invalid vdev specification

use '-f' to override the following errors:

/dev/sdb1 contains a filesystem of type 'vfat'
```

To wipe the disk, run `wipefs -a` with the disk device path. This is a destructive operation that erases all partitioning and label data on the disk. Verify you have the correct device path before running this command.

```text theme={"dark"}
wipefs -a /dev/sdb
```

Example response:

```text theme={"dark"}
/dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 8 bytes were erased at offset 0x1e00ffe00 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
/dev/sdb: calling ioctl to re-read partition table: No error information
```

After the wipe completes, retry the expand step.

## Script Reference

The following is the content of `expand_raid0_pool_to_device.sh`. Copy the entire script when following the steps in this procedure.

```sh theme={"dark"}
#!/bin/sh
usage() {
	echo "Usage $0 [OPTION]"
	echo " Expand EVE-OS ZFS pool to a new device"
	echo " "
	echo " -d Finds unused device"
	echo " -e   Expands raid0 pool to new device"
	exit 1
}

do_find_device=0
do_expand=0
device=""
while getopts "de:h" opt;
do
	case "${opt}" in
		d)
			do_find_device=1
			;;
		e)
			do_expand=1
			device=${OPTARG}
			;;
		*)
			usage
			;;
	esac
done
if [ $do_expand -eq 0 ] && [ $do_find_device -eq 0 ]; then
	usage
fi

if [ $do_find_device -eq 1 ]; then
	found_devs=$(lsblk -nd -e 1,230,43 -o NAME)
	for found_dev in $found_devs; do
		full_dev="/dev/${found_dev}"
		mount | grep -q $full_dev
		mounted=$?
		if [ $mounted -eq 1 ]; then
			zpool status -P | grep -q $full_dev
			in_pool=$?
			if [ $in_pool -eq 1 ]; then
				info=$(lsblk -o SIZE -nd $full_dev)
				echo "Found unused: $full_dev $info"
			fi
		fi
	done
	exit 0
fi

if [ $do_expand -eq 1 ]; then
	grep -q eve_install_zfs_with_raid_level=none /proc/cmdline
	if [ $? -ne 0 ]; then
		echo "Error: invalid eve zfs raid level detected on this device."
		exit 1
	fi

	if [ ! -b $device ]; then
		echo "Error: disk not found, exiting. Please call customer support."
		exit 1
	fi

	read -p "Are you sure you want to expand pool to device ${device}? If so, enter the device path again. " choice
	case "$choice" in
		"$device" )
			zpool add persist $device
			if [ $? -eq 0 ]; then
				zpool set autoexpand=on persist
				if [ $? -eq 0 ]; then
					echo "Success: expand complete"
				fi
		fi
		exit 0
		;;
	* )
		echo "Error: device path mismatch, exiting without action."
		exit 1
		;;
	esac
fi
```

## Next Steps

> [card] [Redundant Storage](https://zededa.mintlify.site/new-ui/infrastructure-services/eve-os-installation/redundant-storage.md)
>
> Information on configuring RAID levels in EVE-OS at installation time.

> [card] [Node Details](https://zededa.mintlify.site/new-ui/infrastructure-services/nodes/node-details.md)
>
> Review a node's storage and hardware details in the console.
