Multiple Disk Support
Longhorn supports two types of disks:
diskType: filesystem): Used by the V1 Data Engine. The disk must be formatted with an extent-based filesystem (for example, ext4 or xfs) and mounted to a directory on the host.diskType: block): Used by the V2 Data Engine. The disk is used as a raw block device without a filesystem.Each disk type is tied to its corresponding data engine:
When a node is first added to Longhorn, the system creates a default filesystem-type disk at /var/lib/longhorn. This default disk is used for V1 volumes unless you disable scheduling for it or add other filesystem-type disks.
Filesystem-type disks are used for V1 volumes. Before adding one to Longhorn, you must prepare and mount it on the host.
/mnt/example-disk. Ensure the directory is accessible and properly configured.After the disk is mounted, you can add it to Longhorn using either the UI or the kubectl command-line tool.
Using the Longhorn UI
Using kubectl Command
kubectl edit node.longhorn.io <node-name> to edit the Longhorn node resource.spec.disks. For example:...
spec:
...
disks:
...
example-disk:
allowScheduling: true
diskDriver: ""
diskType: filesystem
evictionRequested: false
path: /mnt/example-disk
storageReserved: 0
tags: []
...
Once a disk is added:
Notice:
- You cannot add a disk path that is already in use by another Longhorn disk.
- Longhorn uses the filesystem ID to detect duplicate mounts. Therefore, you cannot add a disk with the same filesystem ID as another disk on the same node.
See: Issue #2477
If you prefer to use a different path for a filesystem-type disk (rather than the original mount point), you can use mount --bind to create an alternative path. Do not use symbolic link (lh -s), as these are not properly resolved inside Longhorn pods.
Make sure the alternative path is remounted after a node reboot, for example, by adding it to /etc/fstab.
Block-type disks are used for V2 volumes. The V2 Data Engine requires raw block devices for direct access.
Longhorn supports several ways to manage block-type disks on a node:
nvme driver.virtio-blk driver.aio driver.The V2 Data Engine must be enabled. See V2 Data Engine Quick Start for details.
Longhorn prevents adding block disks that contain an existing file system or partition table. Clean the disk first:
wipefs -a /path/to/block/device
You can add a block-type disk using the Longhorn UI or kubectl.
Using the Longhorn UI
Using kubectl Command
kubectl edit node.longhorn.io <node-name> to edit the Longhorn node resource.spec.disks. For example:...
spec:
...
disks:
...
block-disk:
allowScheduling: true
diskDriver: auto
diskType: block
evictionRequested: false
path: /dev/sdb
storageReserved: 0
tags: []
...
The diskDriver field controls how Longhorn accesses the block device. Setting it to auto allows Longhorn to detect the appropriate driver automatically:
nvme driver. The path can be a BDF (Bus Device Function) notation (e.g., 0000:05:00.0).virtio-blk driver. The path can also be a BDF notation.aio (Linux AIO) driver. The path should be a standard device path (e.g., /dev/sdb).After the disk is added, check node.status.diskStatus to confirm that Longhorn detected the disk without errors and assigned the expected diskDriver.
Note
When a disk is managed by the
nvmeorvirtio-blkdriver, it is no longer exposed through the original Linux kernel device node such as/dev/nvmeXnYor/dev/vdX.
When a block device is neither NVMe nor VirtIO, or when you want to force Linux AIO, configure it with diskDriver: aio and use a standard device path.
aio-disk:
allowScheduling: true
diskDriver: aio
diskType: block
evictionRequested: false
path: /dev/sdb
storageReserved: 0
tags: []
Notice:
- Block-type disks are exclusively used by the V2 Data Engine and cannot be used for V1 volumes.
- The disk must be clean and must not contain an existing file system or partition table before it is added. Use
wipefs -a /path/to/block/deviceto clean it.- For disk-specific configuration examples, see Using NVMe Disks, Using VirtIO Disks, and Using AIO Disks.
To let Longhorn use the nvme driver, add the disk by its BDF instead of the Linux device path.
Identify the available disks on the node. For example:
ls -al /sys/block/
Example output:
lrwxrwxrwx 1 root root 0 Jul 30 12:20 loop0 -> ../devices/virtual/block/loop0
lrwxrwxrwx 1 root root 0 Jul 30 12:20 nvme0n1 -> ../devices/pci0000:00/0000:00:01.2/0000:02:00.0/nvme/nvme0/nvme0n1
lrwxrwxrwx 1 root root 0 Jul 30 12:20 nvme1n1 -> ../devices/pci0000:00/0000:00:01.2/0000:05:00.0/nvme/nvme1/nvme1n1
Find the BDF of the target NVMe disk. In the example above, the BDF of /dev/nvme1n1 is 0000:05:00.0.
Add the disk to spec.disks. For example:
nvme-disk:
allowScheduling: true
diskType: block
diskDriver: auto
evictionRequested: false
path: 0000:05:00.0
storageReserved: 0
tags: []
If you instead add the same disk using /dev/nvme1n1, Longhorn treats it as an aio disk instead of an nvme disk.
VirtIO disks follow the same pattern. To let Longhorn use the virtio-blk driver, add the disk by its BDF.
Identify the available disks on the node. For example:
ls -al /sys/block/
Example output:
lrwxrwxrwx 1 root root 0 Feb 22 14:04 vda -> ../devices/pci0000:00/0000:00:02.3/0000:04:00.0/virtio2/block/vda
lrwxrwxrwx 1 root root 0 Feb 22 14:24 vdb -> ../devices/pci0000:00/0000:00:02.6/0000:07:00.0/virtio5/block/vdb
Find the BDF of the target VirtIO disk. In the example above, the BDF of /dev/vdb is 0000:07:00.0.
Add the disk to spec.disks. For example:
virtio-disk:
allowScheduling: true
diskType: block
diskDriver: auto
evictionRequested: false
path: 0000:07:00.0
storageReserved: 0
tags: []
If you instead add the same disk using /dev/vdb, Longhorn treats it as an aio disk instead of a virtio-blk disk.
You can use the Space Reserved field in the UI or spec.disks.<disk-name>.storageReserved to reserve a portion of any disk’s space (in bytes) for other purposes. This reserved space will not be used by Longhorn for volume data.
To maintain node stability when compute resources (for example memory or disk) are under pressure, the kubelet requires some space to remain free. If these critical resources are exhausted, it can lead to node instability.
For the default filesystem-type disk at /var/lib/longhorn, Longhorn reserves 30% of the root disk space by default to help prevent issues such as DiskPressure conditions from the kubelet, particularly after scheduling multiple volumes. This behavior is controlled by the storage-reserved-percentage-for-default-disk setting.
This automatic reservation applies only to the default filesystem-type disk created for V1 volumes. Block-type disks for V2 volumes must be configured explicitly, including any storageReserved value that you want to apply.
Nodes and disks can be excluded from future scheduling. Note that any storage already scheduled on the node will not be automatically released when scheduling is disabled for the node.
To remove a disk:
Once the disk is empty and scheduling is disabled, you can safely remove it from the node configuration.
There are two global settings that affect disk scheduling.
These settings apply to both filesystem-type and block-type disks. However, the V1 Data Engine uses sparse files for thin provisioning, so over-provisioning behavior is commonly discussed in the context of filesystem-type disks.
StorageOverProvisioningPercentage defines the maximum total storage that can be scheduled on a disk, relative to its usable capacity. The formula is:
ScheduledStorage / (MaximumStorage - ReservedStorage)
The default is 100 (%).
On a 200 GiB disk with 50 GiB reserved, Longhorn sees 150 GiB of usable space. With the default setting, it can schedule up to 150 GiB of volume data.
Since workloads typically do not consume the entire allocated volume size, increasing this setting can help optimize disk utilization. For V1 volumes, higher values are commonly used because the V1 Data Engine uses sparse files for thin provisioning.
StorageMinimalAvailablePercentage specifies the minimum percentage of free space that must remain on a disk in order to schedule new replicas. The formula is:
AvailableStorage / MaximumStorage
The default is 25 (%).
For a 200 GiB disk with 50 GiB reserved, Longhorn will stop scheduling new replicas if available space falls below 37.5 GiB (25% of 150 GiB). A new volume also will not be scheduled if its size would push available space below that limit.
This setting helps prevent disks from becoming too full, which could lead to scheduling failures or volume operation issues.
Warning:
Currently, Longhorn cannot fully enforce the
StorageMinimalAvailablePercentagelimit in all scenarios because:
- Longhorn volumes may use more space than their requested size, especially when snapshots are taken.
- Longhorn allows over-provisioning by default.
© 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.