Resize additional disks in Siderolabs Talos Linux

Resize additional disks in Siderolabs Talos Linux

"Talos will automatically resize the system disk partition(s) if the underlaying block size changes, but not user-managed disks. You would need to schedule a privileged pod with the host /dev/ mounted (kubectl debug node/<name> can do this for you) and use xfs_growfs to expand the filesystem to fit the block device.
Please note that Talos uses XFS, not EXT filesystems" (Source: https://taloscommunity.slack.com/archives/CG25RPZNE/p1718267363829179?thread_ts=1718242104.911039&cid=CG25RPZNE )

Starting from these instructions that I found on the Siderolabs Slack I put togheter these steps to grow the additional disk that I use on my nodes as space for Longhorn:

# create a namespace to kett things tidy
k create ns debug

# allow pod in created namespace to mount the host
k label ns debug pod-security.kubernetes.io/enforce=privileged

# create the debug pod
k debug node/nodename -it --image ubuntu --profile=sysadmin -n debug

# inside the pod
# update packet manager and install desired software
apt-get update && apt-get install xfsprogs parted

# lauch parted
parted

# inside parted I select the correct device
select /dev/sdb

# parted should warn that not all the space is used, type "Fix" and enter
Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space (an extra 10485760 blocks) or continue with the current setting?
Fix

# let's resize the partition
resizepart 1 100%

# exit from parted
quit

# exited parted
# now let's grow the file system
xfs_growfs -d /host/var/lib/longhorn

# it shoud be all ok, let's exit the pod
exit

The pod will continue running unless you delete it. Having all in a single namespace makes it easier to find what's left.