This guide covers the three storage drivers supported by the Firecracker CloudStack Agent (file, lvm, and lvmthin) plus common layouts such as local disks and NFS-backed directories.
| Key | Required | Used by | Description |
|---|---|---|---|
driver |
yes | all | file, lvm, or lvmthin. |
volume_dir |
yes (driver file) |
file | Base directory where RAW/EXT4 images are created. |
vg / volume_group |
yes (lvm, lvmthin) |
lvm / lvmthin | LVM volume group that holds the logical volumes. |
thinpool |
yes (lvmthin) |
lvmthin | Thin-pool LV located inside vg. |
size |
optional | all | Size hint (for example 50G) when the template does not include disk metadata. |
Useful for labs or hosts without LVM. Volumes are sparse files created inside volume_dir.
sudo install -d -m 0750 /var/lib/firecracker/volumes
sudo chown firecracker:firecracker /var/lib/firecracker/volumesConfigure:
"defaults": {
"storage": {
"driver": "file",
"volume_dir": "/var/lib/firecracker/volumes"
}
}Mount the export with options that keep sparse files and locking intact:
sudo apt install -y nfs-common
sudo mkdir -p /mnt/firecracker-volumes
echo "nfs01:/exports/fc-volumes /mnt/firecracker-volumes nfs defaults,_netdev,vers=4.1 0 0" | sudo tee -a /etc/fstab
sudo mount -aPoint volume_dir to the mounted path. Validate I/O latency because Firecracker uses synchronous access (io_engine=Sync).
Creates one thick-provisioned LV per VM inside a traditional volume group.
sudo pvcreate /dev/nvme1n1
sudo vgcreate fc-vg /dev/nvme1n1"defaults": {
"storage": {
"driver": "lvm",
"vg": "fc-vg"
}
}- Ensure the agent’s service account can run
lvcreate,lvremove, andlvchange.
- Enable
issue_discards = 1inlvm.confto reclaim space after deletions (when the device supports TRIM). - Use
lvdisplay -mto verify LVs are active after provisioning.
Leverages thin pools for fast snapshots; ideal for sharing base templates.
sudo pvcreate /dev/nvme2n1
sudo vgcreate fc-vg /dev/nvme2n1
sudo lvcreate -T -L 500G -n fc-thinpool fc-vg- Adjust
chunksizewith-c 256Kif you need a specific performance profile.
"defaults": {
"storage": {
"driver": "lvmthin",
"vg": "fc-vg",
"thinpool": "fc-thinpool"
}
}- The agent ensures a base LV (
base-<template>) exists. If not, it creates a virtual volume (lvcreate -V SIZE -T vg/thinpool) and writes the template image into it. - For each VM it creates a thin snapshot (
lvcreate -s) that points to the base LV. - After every creation or reuse, the agent forces
lvchange -kn,lvchange -ay, andudevadm settleso/dev/<vg>/<lv>is available immediately.
- Use
lvs -a -o+seg_monitorto check thin-pool health. - Alert when
lv_thin_poolusage exceeds ~80% (for example usinglvs --report-format json+ Prometheus).
You can expose block devices via iSCSI/NFS (LIO, targetcli, etc.) and build a PV/VG on top. Ensure aligned block sizes and persist the device via UUID before assembling the VG.
- Restart the agent:
sudo systemctl restart firecracker-cloudstack-agent. - Run
firecracker.sh storage prepare <payload.json>to test the backend. - Confirm the device exists:
ls -l /var/lib/firecracker/volumes # file driver
sudo lvs -a fc-vg # LVM/LVMThinFollowing these steps prepares the host storage layer for CloudStack workloads.