elemental icon indicating copy to clipboard operation
elemental copied to clipboard

Define a proper way to include Longhorn storage in Elemental on a separate disk

Open davidcassany opened this issue 2 years ago • 7 comments

Including Longhorn storage in Elemental-teal deployments is already possible, but cumbersome, requires several configs here and there which are not obvious. In this card we need to:

  • define the desired procedure to set longhorn
  • adapt our current setup and code to make the procedure possible
  • document the procedure

I believe all this essential means to unset the default persistent path for longhorn and explore if there is a simple way to include it within the cloud-init field on the registration yaml.

davidcassany avatar Feb 10 '23 16:02 davidcassany

Would it make sense to have the single disk scenario be in the default config then document how to handle configuration of systems with multiple disks?

agracey avatar Feb 12 '23 12:02 agracey

Hi @davidcassany and @agracey, I have an elemental cluster ready and have installed longhorn on it. Now I want to add another disk to one of the nodes and want to use that disk for longhorn. Below is my file-system (using lsblk). vdb is the new disk (30G) which I added and want to use it as longhorn storage. I created a partition vdb1 as ext4 (using command mkfs.ext4 /dev/vdb1) and created a mount point for longhorn (using command mkdir -p /var/lib/longhorn). image I tried adding /dev/vdb1 /var/lib/longhorn ext4 defaults 0 0 to /etc/fstab but it results in the following error (as seen from the rancher dashboard) : Disk default-disk-959b4ca714f2c137(/var/lib/longhorn/) on node m-c9222f3b-0c70-4b40-80c9-080ee1c2fb26 is not ready: record diskUUID doesn't match the one on the disk What should I do to make longhorn use the new 30G disk instead of the previous one (as in vda5 /var/lib/longhorn)?

navin772 avatar May 23 '23 06:05 navin772

Now I want to add another disk to one of the nodes ...

You want to add a second disk after installation ? This isn't really supported in a declarative system like Elemental. We would need to add a "Longhorn" mode to it 😉

kkaempf avatar May 23 '23 06:05 kkaempf

So can I add second disk before installation and make longhorn use it instead of the defaults?

navin772 avatar May 23 '23 07:05 navin772

You can put whatever is needed into Elemental's cloud-config sections. Esp. writing (config) files and running commands (typically acting on these config files).

See the Elemental documentation for examples.

kkaempf avatar May 23 '23 15:05 kkaempf

You want to add a second disk after installation ?

Sure! People always want more storage, right? ;-)

There's a note in the longhorn docs about using LVM to stitch together multiple disks (see https://longhorn.io/docs/1.5.1/best-practices/#disk-space-management), because then you get one big volume which you can mount under /var/lib/longhorn, then later add more disks to the LVM volume without messing with /etc/fstab and having a bunch of separate filesystems. Would doing that make the elemental deployment / disk management scenario any easier?

With Longhorn's V2 Data Engine (which is SPDK-based), AIUI the need to mess with /etc/fstab goes away, because Longhorn will just directly use block devices. That's still only in preview now though, so doesn't help immediately (see https://longhorn.io/docs/1.5.1/spdk/quick-start/ for more details).

tserong avatar Jul 28 '23 06:07 tserong

Here we can see an old example of how to include LVM volumes in an elemental installation https://elemental.docs.rancher.com/customizing#adding-extra-lvm-volume-group-disks-during-the-installation Old, but it should be still valid, with the difference that now the ISO can be also managed and built using the seedimage resource and there might no need to craft it manually in your local env.

davidcassany avatar Apr 09 '24 09:04 davidcassany