Is there a way to create a VM disk as a file (NFS), instead of a zVol (block)?

titust1

Explorer
Joined
May 10, 2022
Messages
66
Hi everyone, I know the VM storage on file vs block is a debate going on and on.
I noticed that TrueNas Scale allows VM disks only on block devices. But the majority of hypervisors give both possibilities.
Having a VM in a file allows you to copy them, to edit, or clone / replicate them. That’s great.
I don't think not being able to do that is a limitation of ZFS itself but more a limitation of Scale.
I know Scale is pretty young, but is there any plan to do that in the future?

An answer would be highly appreciated.
Thanks a lot
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Having a VM in a file allows you to copy them, to edit, or clone / replicate them. That’s great.
I am interested in how you actively edit a VM virtual disk file in e.g. VMware ESXi, but apart from nitpicking you can definitely copy/clone/replicate zvol based virtual disk images just fine. You can copy an entire zvol to another one to use in a new virtual machine. You can copy an entire zvol to a regular file for backup/archive purposes. You can replicate one or all of your virtual machine zvols to a second system ... so what exactly are you missing?

You should probably look at the zfs send and zfs receive commands, and if your intend to do an off-site backup to another machine or similar, the snapshot and replication task sections of the UI.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
If you're dead set on the file option for a virtual disk, TrueNAS Core allows creation of a RAW device for a VM, which is just a file. I don't know if SCALE allows for creation of a RAW device for a VM.
 

titust1

Explorer
Joined
May 10, 2022
Messages
66
I am interested in how you actively edit a VM virtual disk file
Mr. Sage don't be so picky about every word I write. What I meant is that you can grow or shrink any VMDK, VDI or VHD file, you can mount them as a DVD, you can even open with 7zip and extract files... etc. If you didn't know you can even mount the VD files in Windows like any other hard drive complete with read and write access with ImDisk Toolkit or with VMware DiskMount or Paragon ImgMounter. You can convert from one virtual disk to another, etc. etc. etc. Many possibilities. That's what I meant...
Don't get me wrong, I love Scale, and I think will become better than Core in all aspects, and I am not nitpicking, it was just a question. I don't want to blame anyone. Thanks for the advise
 
Last edited:

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
@titust1, the only way I'm aware of exporting a zvol into a virtual disk image is via dd. This will copy the active sectors into a RAW virtual disk image you can then convert into another virtual disk image format, VMDK, VHD, VDI, etc.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
What I meant is that you can grow or shrink any VMDK, VDI or VHD file
You can grow or shrink a zvol.

you can mount them as a DVD, you can even open with 7zip and extract files... etc.
You can convert from one virtual disk to another, etc. etc. etc.
You can convert a zvol to a file and you can mount a zvol if the OS can read the filesystem in the virtual disk.

If you didn't know you can even mount the VD files in Windows like any other hard drive complete with read and write access with ImDisk Toolkit or with VMware DiskMount or Paragon ImgMounter.
I didn't - thanks! :smile: Probably because I do not use Windows. I have always treated VMDK files as opaque containers and mounted them inside VMs if I really need to extract individual files.
 
Top