Creating a new LXD host - best practices on a 40GB cloud server

I am planning on creating a new LXD host (living on a Hetzer CX21 Cloud Server with 4G RAM and 40G HD) and am wondering how to do this most efficiently. Some question I’d like to be clearer about

  1. Would it be beneficial have a separate partition (on the same HD) for the storage pool rather then creating an image file?
  2. if so, I assume the filesystem of choice on that partition would btrfs, right (probably the lxd init command formats the device with the fs you choose)?
  3. is ubuntu 20.04 already recommended for an LXD host (apt package rather then the snap) or would you still go with 18.04 on a new host?
  1. Yes, dedicated partitions provide significantly better performance
  2. Leave the partition unformatted and LXD will format it for you when you create the storage pool. ZFS tends to be the best experience at this point, but btrfs is a close second (it’s mostly quotas and VMs being a bit less ideal on it).
  3. If you need a deb package, then 18.04 is your only option (with LXD 3.0.x). Any release after that is snap only.

Note that you can either use part of those 40GB for LXD, or use block storage.
Depending on how Hetzner implements those 40GB (are they local to the server?), you may have to select to either repartition the 40GB or go for block storage instead. You can benchmark the two just to make sure whether one is significantly better than the other.

If you decide to repartition the 40GB disk, this might help, https://blog.simos.info/how-to-repartition-a-hetzner-vps-disk-for-zfs-on-its-own-partition-for-lxd/ That blog post is from 2018, there may be some easier way to repartition. If you end up looking into this, please report back on what’s the best way now to repartition the disk in Hetzner.

thx @simos. as always your help is highly appreciated

the recovery interface looks slightly different nowadays then described in your blogpost, but basically you can find your way through the repartitioning with the method described. thanks that was really helpful.

1 Like

would there be any downside to use LVM on creating the machine with a

  • VG of 40G (entire disk)
  • putting LV of 20G for / onto it

and then use the remaining 20G on that VG the btrfs lxd pool?

I believe that may be most flexible in case you need to grow the pool on an external volume at some point and add the space to / if needed

That scenario should be good as well. The ability to boot a VPS into recovery mode, makes it easy to setup either LVM, ZFS (can now boot), btrfs.

yes, that really is easy. My question was more targeting whether a (btrfs) pool can live on a LVM without causing any extra trouble.

That’s a separate and big question. See the discussion at https://unix.stackexchange.com/questions/254286/does-it-make-sense-to-put-btrfs-on-lvm