Storage Configuration
vftool
uses Virtualization.framework
's virtio block device emulation to provide guests with high-performance storage. You can attach multiple disk images, which will appear in the guest OS as block devices (e.g., /dev/vda
, /dev/vdb
).
Disk Image Format
All disk images provided to vftool
must be in the raw format. The framework does not support advanced formats like qcow2
or vmdk
.
You can create a new raw disk image using dd
:
# Creates a 10GB empty raw disk image
dd if=/dev/zero of=my-disk.img bs=1g count=10
Attaching Disks
You can attach disk images using the -d
(read-write) and -c
(read-only) flags.
-d <path>
: Attaches a disk image in read-write mode. This is used for your primary operating system disk or for data disks that need to be modified.-c <path>
: Attaches a disk image in read-only mode, which is useful for ISOs or other shared base images.
Multiple Disks and Device Order
You can attach up to 8 storage devices in total by specifying the -d
and -c
flags multiple times. The order of the flags on the command line determines the device name inside the guest.
For example, consider the following command:
vftool -k ... -d rootfs.img -d data.img -c tools.iso
This will create three storage devices inside the VM:
/dev/vda
: Attached torootfs.img
(read-write)/dev/vdb
: Attached todata.img
(read-write)/dev/vdc
: Attached totools.iso
(read-only)
This predictable ordering is crucial for configuring your guest's /etc/fstab
and kernel root=
parameter.