Member-only story
Add a Second Disk for Longhorn Storage in OpenShift Cluster
I need additional storage for my Longhorn storage class beyond the default volume on the OpenShift cluster nodes. I will add a second disk to the OpenShift Cluster to grow the storage size. Instead of using the machine config of OpenShift, we will adopt the native approach to unveil more details of what’s happening exactly under the hood and avoid common pitfalls.
Create a File System
My VMs are KVM based, so use qemu-img to create a raw disk and virsh attach-disk to add the disk to the worker node.
qemu-img create -f raw /kvm-images/{{ .vmName }}-disk2.img 100G
virsh attach-disk {{ .vmName }} --source /kvm-images/{{ .vmName }}-disk2.img --target vdb --persistentLonghorn supports raw block devices with SPDK (Storage Performance Development Kit), but since SPDK is not enabled on OpenShift CoreOS by default, we use a filesystem-backed volume instead.
Log on to the worker node with SSH, perform the following LVM action to create a new filesystem.
sudo pvcreate /dev/vdb
sudo vgcreate vg-data /dev/vdb
sudo lvcreate -l 100%FREE -n lv-data vg-data
sudo mkfs.xfs /dev/vg-data/lv-dataLVM allows flexible storage management and makes future expansion easier.
