Multiple Disk Support
Longhorn supports to use more than one disk on the nodes to store the volume data.
/var/lib/longhorn on the host will be used for storing the volume data. You can avoid using the default directory by adding a new disk, then disable scheduling for
To add a new disk for a node, heading to
Node tab, select one of the node, and select
Edit Disks in the drop down menu.
To add any additional disks, user needs to:
Longhorn will detect the storage information (e.g. maximum space, available space) about the disk automatically, and start scheduling to it if it’s possible to accommodate the volume. A path mounted by the existing disk won’t be allowed.
A certain amount of disk space can be reserved to stop Longhorn from using it. It can be set in the
Space Reserved field for the disk. It’s useful for the non-dedicated storage disk on the node.
The kubelet needs to preserve node stability when available compute resources are low. This is especially important when dealing with incompressible compute resources, such as memory or disk space. If such resources are exhausted, nodes become unstable. To avoid kubelet
Disk pressure issue after scheduling several volumes, by default, longhorn reserved 30% of root disk space (
/var/lib/longhorn) to ensure node stability.
If the users don’t want to use the original mount path of a disk on the node, they can use
mount --bind to create an alternative/alias path for the disk then use the it with Longhorn. Notice that soft link
ln -s won’t work since it will not get populated correctly inside the pod.
Longhorn will identify the disk using the path, so the users need to make sure the alternative path are correctly mounted when the node reboots, e.g. by adding it to
Nodes and disks can be excluded from future scheduling. Notice any scheduled storage space won’t be released automatically if the scheduling was disabled for the node.
In order to remove a disk, two conditions need to be met:
Once those two conditions are met, you should be allowed to remove the disk.
There are two global settings affect the scheduling of the volume.
StorageOverProvisioningPercentagedefines the upper bound of
ScheduledStorage / (MaximumStorage - ReservedStorage). The default value is
200(%). That means we can schedule a total of 300 GiB Longhorn volumes on a 200 GiB disk with 50G reserved for the root file system. Because normally people won’t use that large amount of data in the volume, and we store the volumes as sparse files.
StorageMinimalAvailablePercentagedefines when a disk cannot be scheduled with more volumes. The default value is
10(%). The bigger value between
MaximumStorage * StorageMinimalAvailablePercentage / 100and
MaximumStorage - ReservedStoragewill be used to determine if a disk is running low and cannot be scheduled with more volumes.
Notice currently there is no guarantee that the space volumes used won’t exceed the
© 2019-2023 Longhorn Authors | Documentation Distributed under CC-BY-4.0
© 2023 The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.