Skip to content

Instantly share code, notes, and snippets.

@s8sg
Last active February 13, 2022 23:33
Show Gist options
  • Save s8sg/b4cdc5eded78b62e43b01895585d0626 to your computer and use it in GitHub Desktop.
Save s8sg/b4cdc5eded78b62e43b01895585d0626 to your computer and use it in GitHub Desktop.
Volume Mount Firecracker

Create qcow image

qemu-img create -f qcow2 file.qcow2 100M
sudo mkfs.ext4 file.qcow2

Add drive it to the MicroVM

--add-drive=file.qcow2:rw

Validate inside guest

fdisk -l
Disk /dev/vda: 30 MiB, 31457280 bytes, 61440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/vdb: 192 KiB, 196608 bytes, 384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Mount inside the guest machine

mount /dev/vdb /mnt

@wenerme
Copy link

wenerme commented Feb 25, 2021

This is not qocw2, sudo mkfs.ext4 file.qcow2 make the file.qcow2 become raw file

@ybkimm
Copy link

ybkimm commented Feb 13, 2022

dd if=/dev/zero of=volume.ext4 bs=1024 count=0 seek=102400
sudo mkfs.ext4 volume.ext4

Also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment