Wiki
Clone wikibnbd / Home
About
bnbd is an alternative NBD server implementation.
Below are some of its key features:
- multi-threaded design
- direct asynchronous I/O over sparse files to access virtual volumes data
- NBD requests and replies pipelining
- AIO requests batching
- concurrent access to virtual volumes from multiple clients
- simple network accessible management CLI
- simple key-value configuration file
- 2-clause BSD license
- clean code base (YMMV)
Install
Prerequisites:
- clang or gcc
- gmake
- pcre-dev
- libaio-dev
$ git clone -b BeloNBD_RELEASE_1_1 https://bitbucket.org/belczyk/bnbd.git
$ cd bnbd
$ gmake
$ sudo gmake install
Configure
# cd /etc/bnbd # cp -i bnbd-server.conf.sample bnbd-server.conf # vim bnbd-server.conf
Note: the ctrl_directory
and the data_directory
must be created manually.
Run
# ulimit -s 128 # bnbd-server
Use
Note: make sure this patch was applied against the NBD driver before using it with bnbd.
Note: make sure NBD client version is at least 3.3.
Create a volume:
$ rlwrap telnet 0 10810 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. +OK volume create id=vol0 size=1024 +OK Success volume up id=vol0 +OK Success volume list +OK Volume list follows id=vol0 size=1073741824 used=0 blksize=4096 status=up quit +OK Bye Connection closed by foreign host.
# modprobe nbd # bnbd-client -N vol0 /dev/nbd0 Setting up /dev/nbd0 Volume=vol0 Block=4096 Host=127.0.0.1 Port=10809 Timeout=60 Q_Add_Random=0 Q_Max_Sectors_KB=128 Q_NoMerges=0 Q_NR_Requests=128 Q_Read_Ahead_KB=128 Q_Scheduler=noop Negotiation: ..size = 1024MB bs=4096, sz=1073741824 bytes timeout=60
Use the volume:
# dd if=/dev/zero of=/dev/nbd0 bs=1G count=1 oflag=direct 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 4.24804 s, 253 MB/s # mkfs.xfs /dev/nbd0 meta-data=/dev/nbd0 isize=256 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=0 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 # mkdir /mnt/vol0 # mount -t xfs -o rw,noatime /dev/nbd0 /mnt/vol0 # ls -l /mnt/vol0/ total 0 # umount /mnt/vol0
Updated