To configure a new data disk in the cluster, take the following steps:
Step 1: Adding a new disk to the node
Once the disk is attached to the node, format it and mount it to some location.
Note:
The following steps assume that you have mounted the new disk in the
/datadisk1
location.
Sample script to mount the new disk to the `/datadisk1` location in an Azure VM
sudo -i
DATADISK_MOUNT="/datadisk1"
DATA_DISK_DEV="/dev/$(tree /dev/disk/azure | grep -w "\slun0\s" | awk -F/ '{print $NF}')"
# if this fails try to hardcode the data disk that you see attached when using command lsblk
# example: DATA_DISK_DEV="/dev/sdc"
echo "Partitioning ${DATA_DISK_DEV}, creating partition \"data\" with 100%"
parted "${DATA_DISK_DEV}" --script mklabel gpt mkpart "data" ext4 0% 100%
while [[ ! "$(blkid -o device | grep -e "^${DATA_DISK_DEV}1$")" ]]; do
echo "Waiting for ${DATA_DISK_DEV}1 to be available"
sleep 5;
done
echo "Creating ext4 FS for ${DATA_DISK_DEV}1"
mkfs.ext4 "${DATA_DISK_DEV}1"
partprobe "${DATA_DISK_DEV}1"
mkdir "${DATADISK_MOUNT}"
mount "${DATA_DISK_DEV}1" "${DATADISK_MOUNT}"
UUID=$(blkid -o value -s UUID "${DATA_DISK_DEV}1")
grep -q "${DATADISK_MOUNT}" /etc/fstab ||
printf "# data-disk\nUUID=%s %s ext4 defaults 0 0\n" "${UUID}" "${DATADISK_MOUNT}" >> /etc/fstab
exit
Note:
In multi-node HA-ready production installations, it is recommended to attach additional disks to all the server nodes. There is no need to attach additional disks to agent nodes.
Step 2: Getting the password for the Rancher server
Perform the following steps from one of your server nodes:
- Ensure that you are a root user.
sudo su -
- Ensure that you have set the right environment variables.
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
export PATH=$PATH:/var/lib/rancher/rke2/bin
- Run the following commands to get the server password.
kubectl get secrets rancher-admin-password -n cattle-system \
-o jsonpath={.data.password} | echo $(base64 -d)
Step 3: Login to the Rancher server
- Navigate to the Rancher server by entering
monitoring.fqdn
in your browser's address bar.
Note:
If your cluster FQDN is
automationsuite.mycompany.com
, then rancher server URL ismonitoring.automationsuite.mycompany.com
.
- Use the following credentials:
- Username:
admin
- Password: retrieved in Step 2.
Step 4: Navigate to Longhorn nodes configuration
- Click the Explorer button as shown in the following image.


- Click Cluster Explorer in the top-left corner, and then select Longhorn as shown in the following image.


- Select Longhorn on the Overview page.


- On a Longhorn dashboard, select Node in the top navigation bar.


Step 5: Open Edit Node and Disk configuration dialog
- Select the node and click the Edit Node and disks button.


Step 6: Add a new disk in the cluster
- Click the Add Disk button.


- Provide the following details:
-
Path: Path where you have mounted additional datadisk in Step 1. If you are mounting new disk at location /datadisk1, then use this location
-
Storage Reserved: 0 Gi
-
Scheduling: Enabled


- Once you have filled in the required information, click the Save button.
Step 7: Verify the disk is configured in the cluster
- Once the disk is configured in cluster, you can see a Ready and Schedulable status next to it, as shown in the following image:


Important!
In multi-node HA-ready production installations, you have to perform Step 5, Step 6, and Step 7 for all the server nodes on which you attached new disks.
Updated 3 months ago