OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 10:43 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: nbd-bind: a tool to access disk images as block devices
PostPosted: Sun Dec 01, 2013 7:45 am 
Offline
Member
Member

Joined: Mon Sep 07, 2009 12:01 pm
Posts: 149
One of the reasons I switched from Windows to Linux was to be able to use mount, and generally be able to deal with devices properly. For OS development, however, this still isn't enough; it doesn't let you mount eg. a VDI disk image from VirtualBox. I found that QEMU had a rather useful tool called qemu-nbd, which would let you bind a disk image to a block device, with all the partitions available as block devices as well, which is what I wanted. But qemu-nbd has to be run as root, and you can't be sure of the name of the block device in advance, which makes it tricky to use in a Makefile. So, a few months ago I wrote nbd-bind, a wrapper around qemu-nbd to solve these problems, and I've finally got round to releasing it.

The source is available on GitHub: https://github.com/mark-raymond/nbd-bind, and there's more info there about how it works, along with an example of how it can be used in a Makefile.

The general usage is like this:
Code:
nbd-bind disk-image.vdi device-name
which will make disk-image.vdi available as a block device called device-name, and its partitions available as block devices called device-name-p1, device-name-p2 etc. Once you're finished, you just run:
Code:
nbd-unbind device-name

I hope that this is of some use to the OSDev community, and any feedback - on the code, the (minimal) docs, or the general premise - would be appreciated!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 105 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group