Git Product home page Git Product logo

nbd's Introduction

License

Copyright 2018 Sam Pullara

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Network Block Device

The nbd-client on Linux allows you to mount a remote server implementing the NBD protocol as a local block device. This NBDServer exports volumes whose data is stored in FoundationDB. This gives you a highly scalable, high performance, reliable block device that you can then format and put a filesystem on it.

The NBDCLI command allows you to create new volume, list the volumes you have in your system, delete a volume or snapshot a current volume to another volume.

HOWTO

Bring up FoundationDB and then run the NBDServer. It will be listening on the default 10809 port.

java -jar nbdcli.jar server

Create a new 1G volume:

java -jar nbdcli.jar create -n [volume name] -s 1G 

On a Linux host, install ndb, create the block device, format it and mount it:

sudo apt-get update && apt-get install nbd
sudo modprobe nbd
sudo nbd-client -N [volume name] [host] /dev/nbd0
sudo mkfs.xfs /dev/nbd0
mkdir tmp
sudo mount /dev/nbd0 tmp

You may need to change the ownership on that directory to access it but you can now save files there and they will be backed by FoundationDB. Each volume can only be shared to a single nbd client at a time.

Under the covers

Each volume is a sparse array of bytes (FDBArray) stored in FoundationDB across many rows in the database. In addition each volume can have a parent whose sparse array shows through where the child volume hasn't written yet. Here is the interface that we implement:

public interface Storage {
  void connect();

  void disconnect();

  CompletableFuture<Void> read(byte[] buffer, long offset);

  CompletableFuture<Void> write(byte[] buffer, long offset);

  CompletableFuture<Void> flush();

  long size();

  long usage();
}

nbd's People

Contributors

spullara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nbd's Issues

Error when mounting a snapshot

Hey Sam,

Thanks for this project. The performance I'm seeing in the initial testing is really quite incredible :)

I have a 1GB myvol2 created based on your readme successfully mounted as an ext4 disk that Ubunto also reports a 1GB and file writes/reads works perfectly.

I did however run into an error when trying to mount a snapshot of it:

java -jar nbdcli.jar snapshot -v myvol2 -n snapshotvol
> Successfully snapshotted myvol2 as snapshotvol

sudo nbd-client localhost -g -nonetlink -N snapshotvol /dev/nbd4
> Negotiation: ..size = 235626205MB
> bs=512, sz=247071983730176 bytes

So size seems off here on the snapshot? Then trying to mount gives:

sudo mount /dev/nbd4 tmp-snapshotted/
> mount: /home/jimmeyer/IdeaProjects/nbd/target/tmp-snapshotted: can't read superblock on /dev/nbd4

Any ideas on how to proceed? Thanks.

Licensing?

What is the licensing?

FDB is now apache 2 licensed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.