A block device in user space for Linux
Go to file
Pete Nelson e4fd3b729f loopback.c, busexmp.c: get rid of compiler warnings 2013-06-27 17:03:10 -04:00
.gitignore Updated the .gitignore file. 2011-12-15 00:40:49 -08:00
Makefile * BUSEDevice.cpp: 2012-12-11 16:13:14 +09:00
README Added instructions on running the example code to the README. 2011-11-23 15:04:58 -08:00
buse.c buse.c: conditional defines to work with older nbd versions 2013-06-27 13:27:10 -04:00
buse.h buse.h: use distro's nbd.h instead of copy/paste 2013-06-27 13:27:53 -04:00
busexmp.c loopback.c, busexmp.c: get rid of compiler warnings 2013-06-27 17:03:10 -04:00
loopback.c loopback.c, busexmp.c: get rid of compiler warnings 2013-06-27 17:03:10 -04:00

README

BUSE - A block device in userspace

Adam Cozzette
Fall 2011

This piece of software was inspired by FUSE, which allows the development of
Linux file systems that run in userspace. The goal of BUSE is to allow virtual
block devices to run in userspace as well. Currently BUSE is experimental and
should not be used for production code.

Implementing a block device with BUSE is fairly straightforward. Simply fill
struct buse_operations (declared in buse.h) with function pointers that define
the behavior of the block device, and set the size field to be the desired size
of the device in bytes. Then call buse_main and pass it a pointer to this
struct. busexmp.c is a simple example example that shows how this is done.

The implementation of BUSE itself relies on NBD, the Linux network block device,
which allows a remote machine to serve requests for reads and writes to a
virtual block device on the local machine. BUSE sets up an NBD server and client
on the same machine, with the server executing the code defined by the BUSE
user.

Running the Example Code

BUSE comes with an example driver in busexmp.c that implements a 128 MB memory
disk. To try out the example code, run "make" and then execute the following as
root:

modprobe nbd
./busexmp -n /dev/nbd0

You should then have an in-memory disk running, represented by the device file
/dev/nbd0. You can create a file system on the virtual disk, mount it, and start
reading and writing files on it:

mkfs.ext4 /dev/nbd0
mount /dev/nbd0 /mnt