[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] NBD support

From: Laurent Vivier
Subject: [Qemu-devel] [PATCH] NBD support
Date: Tue, 27 May 2008 16:56:32 +0200


This patch introduces a new tool: qemu-nbd.

qemu-nbd allows to export and mount a Qemu disk image using "Network
Block Device" protocol.

This work has been done by Anthony Liguori.

Original files:


You can export a disk image with:

$ qemu-nbd my_disk.qcow2

and mount it on a remote host from the host "disk_server" with:

# nbd-client disk_server 1024 /dev/nbd0

of course, you need to load the nbd kernel module.

if you want to mount locally the file, you need to use a 2.6.26 kernel
to avoid an NBD deadlock on UP machine

With a 2.6.26 kernel you can also mount a specific partition:

# rmmod nbd
# modprobe nbd max_part=63
# nbd-client 1024 /dev/nbd0
Negotiation: ..size = 4194304KB
bs=1024, sz=4194304
# fdisk -l /dev/nbd0

Disk /dev/nbd0: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

     Device Boot      Start         End      Blocks   Id  System
/dev/nbd0p1   *           1         492     3951958+  83  Linux
/dev/nbd0p2             493         522      240975    5  Extended
/dev/nbd0p5             493         522      240943+  82  Linux swap / Solaris
# mount /dev/nbd0p1 /mnt
# ls /mnt
bin    dev   initrd      lib64       mnt   root  sys  var
boot   etc   initrd.img  lost+found  opt   sbin  tmp  vmlinuz
cdrom  home  lib         media       proc  srv   usr
# umount /mnt
# nbd-client -d /dev/nbd0

NOTE: qemu-nbd itself is able to export only one partition instead of
the whole disk (option --partition=N)

----------------- address@hidden  ------------------
  "La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry

Attachment: qemu-nbd.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]