Skip to main content

QEMU Storage & Block Devices

Operations

# Convert Image
qemu-img convert -f parallels original.hds -O raw converted.raw

iSCSI

# Connect to iSCSI target
qemu-system-x86_64 -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \
-cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \
-drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1

NBD (Network Block Device)

# Create image
qemu-img create test -F qcow2 test.qcow2

# Export via QEMU Storage Daemon
qemu-storage-daemon \
--blockdev driver=qcow2,node-name=test,file.filename=test.qcow2,file.locking=off,file.driver=file \
--nbd-server addr.type=inet,addr.host=0.0.0.0,addr.port=6789 \
--export nbd,device=test

# Export via qemu-nbd (default port 10809)
qemu-nbd -f qcow2 file.qcow2

NBD Server Options

--nbd-server addr.type=inet,addr.host=<host>,addr.port=<port>
# Optional TLS
# [,tls-creds=<id>][,tls-authz=<id>]