Skip to content

Instantly share code, notes, and snippets.

@archerslaw
Last active December 21, 2020 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save archerslaw/11278973 to your computer and use it in GitHub Desktop.
Save archerslaw/11278973 to your computer and use it in GitHub Desktop.
nbd storage backend in qemu.
Network Block Device(nbd):
In Linux, a network block device is a device node whose content is provided by a remote machine. Typically, network block devices are used to access a storage device that does not physically reside in the local machine but on a remote one. As an example, the local machine can access a fixed disk that is attached to another computer.
1.start nbd-server to export a qcow2 image with absolute path on the NBD server host.
# nbd-server 12345 /home/my-data-disk.qcow2
2.launch a KVM guest with this exported image as a data disk.
# qemu-img info nbd:10.66.83.171:12345
image:
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: unavailable
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
e.g:...-drive file=nbd:10.66.83.171:12345,if=none,id=drive-data-disk,format=qcow2,cache=none,aio=native -device virtio-scsi-pci,id=scsi1,addr=0x7,bus=pci.0 -device scsi-hd,bus=scsi1.0,drive=drive-data-disk,id=data-disk,bootindex=2
@mkvdv
Copy link

mkvdv commented Apr 23, 2018

Thank You, it was helpful =)

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