Thanks for the replies, there are still a few things I'd like to get a little more clarity on.
ZFS in general and TrueNAS in particular are quite resource hungry. 16 GB is the minimal recommended RAM for a basic setup. This also applies to basic home setups. Virtualising TrueNAS is dangerous. Also, and perhaps especially, in home settings.
-I want to believe it but I don't see/understand why it would need so much RAM usage. I virtualized TrueNAS yesterday (and today) with 1.97 GB RAM allocated to TrueNAS. This is not because I think 1.97 GB of RAM is enough but I am using a desktop that simply only has 4 RAM total for the whole system. You know it's a test setup. TrueNAS on its own has never crashed and shows no sign of ever crashing (with only 1.97 RAM). What did happen, when installing Nextcloud, the 'installer' crashed halfway through the installation, it reported that there was no RAM available. In the end this wasn't a huge problem either as when I tried to install it again it resumed from the point where it crashed and completed the entire installation. The intention is to run Nextcloud and two or three similar services. 4.5 GB of RAM allocated to the VM seems sufficient for this to me. Do you agree that no strange things will happen with TrueNAS if it has access to 4.5 GB RAM and runs a maximum of 4 services similar to Nextcloud?
My FreeBSD system with the PeKWM window manager has +- 60 MB of active RAM usage (in idle). All the rest of the RAM can be redirected to other applications/processes if they need RAM.
The hypervisor will need more than 16 GB RAM. ESXi with proper HBA pasthrough is the sole recommended option. You're welcome to be a guinea pig with HBA pasthrough in Proxmox.
-Have any large-scale tests been done that show statistically that ESXi or Proxmox are really more stable than what you get with VirtualBox on FreeBSD? VirtualBox on FreeBSD is very stable to me, always has been. And I've also used VMware on OpenSUSE in the past, I virtualized macOS. I have also often virtualized windows on various virtualization software. In my experience, 'what is commonly thought' is not always correct. Statistics are also not always easy to interpret correctly, if no mistakes have already been made during the design of the sample. But statistics is better than nothing. So my question: are there many independent statistics on the stability and security of the various virtualization software out there? (preferably tested on different operating systems such as FreeBSD)
Anything else is likely to fail and lose all your data.
-If you use AHCI as a controller for two different .vhd volumes on two different hard drives, can you have a safe RAID configuration? It is already unlikely that the VM will ever crash. Because it seems completely stable. Suppose it were to crash, that doesn't mean there would be data loss at all, would it? I haven't encountered a corrupt file in over 4 years on FreeBSD. Suppose data were to be corrupted somewhere during the crash, then I still have the RAID protection. I don't see why it would be unsafe.
If you do want to have an audio-enabled NAS with a small footprint, your best option is to start from a regular FreeBSD or Linux distribution and set it up for server duties for your specifications. There will be no GUI niceties but you can trim the system down to save resources.
-Agreed, but that may make it too complicated for the NAS user to configure new things. For me this would work. But for the person who would use the NAS, it is useful to be able to use the (TrueNAS) GUI.
Apart from these things, I would like to say how bad/well it currently works. The stability of the VM doesn't seem to be an issue. I don't think it's going to crash, ever. That's how it seems now. I know I haven't tested it long enough to be sure. The CPU usage of my entire FreeBSD system + TrueNAS VB VM + Nextcloud plugin hovers around 1.4% CPU usage on average. Every +- 15s there is a super short spike to +- 30% CPU usage and that spike disappears immediately. This is not a fixed pattern or anything, just how it behaves on a random average. So it seems efficient enough to me to use as a real NAS setup in practice.
Logging into the TrueNAS GUI from a cell phone or laptop via Wi-Fi is rather a snappy experience with the current test setup. I don't see any problems there. It changes when I use Nextcloud. Logging in is rather slow, but fast enough. Switching to the menus in Nextcloud is not snappy, but doable. Uploading and downloading large files in the GUI is fast enough 'on the network'. Though there's room for improvement when I do it 'on the host'. About the network, I think I have a network bottleneck, which means that it cannot really go faster on systems that are connected via Wi-Fi. For the download/upload performance in Nextcloud there I don't see any significant problems just that I would expect it to go faster on the host intself. Something I have noticed is a glitch in Nextcloud, if I play multiple audio/videos in succession in Nextcloud, the 'audio/video player' of Nextcloud no longer works. I'm just talking about starting the audio/video, it's not that it has problems while playing. I can easily solve this by changing the menu in Nextcloud and then the player will work again. I'm not going to go into detail here because this is probably a glitch in Nextcloud that has nothing to do with TrueNAS. There are no real showstoppers in using Nextcloud on my current test setup that allocates 2GB RAM to TrueNAS.
My .vdi partition of VirtualBox is installed on the SSD. I also tested for the experiment whether it matters if I change .vhd partition to a slow HDD for the Nextcloud zone, but I don't see any performance difference when I switch between SSD or a HDD for this .vhd partition. I don't know where the bottleneck is for upload/download performance in Nextcloud when I'm on the host (FreeBSD). Maybe it's VirtualBox, maybe bhyve is faster.
My general conclusion at the moment is that it is doable via VirtualBox. In terms of stability, I don't see a problem, so the only potential issue I've seen is performance. I have seen a bottleneck with the upload/download in Nextcloud. Although this does not play a role on my current network, it is of course always better that the bottleneck is resolved for the situations where I use Nextcloud in a browser on the host itself. CPU usage can also be improved, although it is very acceptable. So I think bhyve can potentially lower the CPU usage and improve the upload/download bottleneck in Nextcloud.
One last thing I would like to mention, normally for TrueNAS you always need a disk to install the OS on and then one or more disks for storage. Suppose you have a large SSD, then I can run everything on FreeBSD + VB on one SSD. You do have the risk that that one disk can fail, but my point is that it is nice to have this feature.