Datasets: Intended Way to Use Reserved Space for Dataset and All Children with Quota?

sinisterpisces

Dabbler
Joined
Jan 14, 2024
Messages
17
Hello!

I'm still pretty new at TrueNAS/ZFS, so I apologize if I'm missing something obvious.

I'm setting up a dataset to store MariaDB files for a database server: "MariaDBStore."

It will have two child datasets (mostly so I can control how big they get and individually adjust recordsize), like this:
Code:
MariaDBStore (125 GiB Max Space for Dataset and All Children)
--> Logs (128k recordsize, 2 GiB max space)
--> Data (16k recordsize for MariaDB data, SNAPSHOT YES)


My SSD-backed pool has limited space, so I've set a reservation for dataset and all children on MariaDBStore.

I'm not quite sure how to do the rest to accomplish what I want. I've read up here on how to combine quotas and datasets, but it seems like there's a lot more tweak it 'till you make it involved than hard and fast best practices. ;)

I think what I need to do is this, given the reservation on the parent dataset:
  1. Set a 2 GiB quota on Logs. I've already reserved the parent, so I don't think I have to reserve space inside the space I already reserved, just put an upper bound on it that's less than the reservation. Correct?
  2. Data, I'm confused on, mostly due to not undestanding Snapshots fully yet.
    1. I don't really want to set a bound on Data beyond the parent reservation itself. I plan to have one MariaDB VM handling multiple databases, to the extent I can get away with that, so I want it to have as much space as I can give it.
    2. But, I also want to use snapshots for Data. This will be my first time using snapshots on ZFS or TrueNAS, so I'm not really sure what I need to do here to make sure there's a decent amount of snapshot space to let me catch and roll-back issues within, like, the past week or two.
      1. Do I actually need to use a quota here to make sure there's sufficient snapshot space? (I'm coming from QNAP's non-ZFS OS, which requires me to manually manage "reserved snapshot space.")
      2. Or, do I just set up the snapshot schedule and retention policy I want when I set up the snapshots and just keep adjusting that until it's not taking up more space than I want?
I'd appreciate any advice on how to get the results I'm looking for. Thanks!
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623
I haven't fully understood what you are doing. Regarding 2.2.2 that's what I would do
Snapshots do not really use space. They are just information about the used blocks at the time of the creation. Basically your deleted / changed files between snapshots dictate the space used.

You have 10 GB of data and create a snapshot. This will use no space.
You delete 3 GB and take a snapshot again. This will now use 3GB.
Overall you still only use 10 GB. If you now add 2GB of data you have used 12 GB in total.
9 GB for your live dataset (10-3+2 GB) and additional 3 GB for the deleted files.
 
Top