On a minimum size: there's no option for this, and unfortunately it wouldn't help even if there were. Writes can land on any part of the address space, so pre-allocating a minimum range doesn't guarantee it will actually be used. For example, with a 2 GB disk and a 1 GB minimum covering the 0–1 GB range, a file written to the 1–2 GB range forces the driver to allocate fresh memory anyway, and the pre-allocated block is effectively wasted.
That's why there are really only two sensible modes:
- Dynamic allocation alone, where memory grows as needed but stays allocated until reboot, so eventually the whole disk is backed by RAM.
- Dynamic allocation with TRIM, where the memory unused for a couple of minutes is released back to the system. The short delay avoids churn when files are created and deleted rapidly, and there is genuinely no downside to keeping TRIM on, as memory is returned when not needed and re-allocated when it is.
On increasing the size only for a session: this isn't something we can offer at the moment. Temporary resizing gets tricky because, for instance, an image backing file would have to grow with the disk and can't then be shrunk mid-session.
For your use case, the cleanest approach is actually already supported: create a dynamically allocated RAM disk with TRIM enabled, sized close to your total RAM (for example, 16 GB). Until you write to it, its real memory footprint is zero: it only grows as you write files and shrinks shortly after they are deleted. That's the most efficient setup and what we recommend.