|
| 1 | +Windows Network Block Device (WNBD) |
| 2 | +=================================== |
| 3 | + |
| 4 | +Build Status: |
| 5 | +------------- |
| 6 | +[](https://ci.appveyor.com/project/aserdean/wnbd/branch/master) |
| 7 | + |
| 8 | + |
| 9 | +What is WNBD? |
| 10 | +------------- |
| 11 | + |
| 12 | +WNBD is a client side implementation of [Network Block Device](https://nbd.sourceforge.io/) |
| 13 | + |
| 14 | +Prerequisites |
| 15 | +------------- |
| 16 | + |
| 17 | +Visual Studio 2019 build tools or GUI ([Community version](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16) or above) |
| 18 | + |
| 19 | +[Windows Driver Kit 1909](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) |
| 20 | + |
| 21 | +Folders |
| 22 | +------- |
| 23 | + |
| 24 | +* <a href="Dockerfile/">Dockerfile</a> contains a Dockerfile to create a Docker image that contains needed prerequisites |
| 25 | + |
| 26 | +* <a href="driver/">driver</a> contains the driver sources |
| 27 | + |
| 28 | +* <a href="lib/ksocket_wsk/">ksocket_wsk</a> contains the WSK implementation needed to communicate with the Network Block Device server |
| 29 | + |
| 30 | +* <a href="userspace/userspace/">userspace</a> contains a simple console application `wnbd-client` useful for testing |
| 31 | + |
| 32 | +* <a href="vstudio/">vstudio</a> contains the Visual Studio solution file and its projects |
| 33 | + |
| 34 | +How to build |
| 35 | +------------ |
| 36 | + |
| 37 | +``` |
| 38 | +> git clone https://github.com/aserdean/wnbd |
| 39 | +> msbuild wnbd\vstudio\wnbd.sln |
| 40 | +> copy wnbd\vstudio\x64\Debug\driver\* . |
| 41 | +> copy wnbd\vstudio\x64\Debug\wnbd-client.exe . |
| 42 | +``` |
| 43 | + |
| 44 | +* You can download the latest prebuilt packages from Appveyor via the links: |
| 45 | + * [Debug](https://ci.appveyor.com/api/projects/aserdean/wnbd/artifacts/wnbd-Debug.zip?job=Configuration%3A+Debug) |
| 46 | + * [Release](https://ci.appveyor.com/api/projects/aserdean/wnbd/artifacts/wnbd-Release.zip?job=Configuration%3A+Release) |
| 47 | + |
| 48 | +How to install |
| 49 | +-------------- |
| 50 | + |
| 51 | +* **Prerequisites**. |
| 52 | + |
| 53 | + After building, the driver is automatically test signed. To install the built driver you must make sure that your target machine is Test Signed enabled first. |
| 54 | + To enable Test Signing on your target machine, please issue the following from an elevated command prompt: |
| 55 | + ``` |
| 56 | + > bcdedit.exe /set testsigning yes |
| 57 | + ``` |
| 58 | + Please note that you can enable driver signing only if Secure Boot is not enabled on the target machine. |
| 59 | + To check if your target machine does not have Secure Boot enabled issue `Confirm-SecureBootUEFI` from an elevated powershell prompt |
| 60 | + ``` |
| 61 | + PS C:\WINDOWS\system32> Confirm-SecureBootUEFI |
| 62 | + False |
| 63 | + ``` |
| 64 | + |
| 65 | +* **Installation/removal**. |
| 66 | + |
| 67 | + We require [devcon.exe](https://cloudbase.it/downloads/devcon.exe) utility to install and uninstall the driver. |
| 68 | + |
| 69 | + * To **install** the driver issue the following from an elevated command prompt: |
| 70 | + ``` |
| 71 | + > .\devcon.exe install .\wnbd.inf root\wnbd |
| 72 | + ``` |
| 73 | + (The command above assumes that the utility `devcon.exe` and the driver files `wnbd.inf`, `wnbd.cat`, `wnbd.sys` are in the current directory) |
| 74 | +
|
| 75 | + * To **uninstall** the driver issue the following from an elevated command prompt: |
| 76 | + ``` |
| 77 | + .\devcon.exe remove "root\wnbd" |
| 78 | + ``` |
| 79 | + (The command above assumes that the utility `devcon.exe` is in the current directory) |
| 80 | +
|
| 81 | + For convenience, we included <a href="vstudio/reinstall.cmd">reinstall.cmd</a> which uninstalls (ignoring the error) and installs the driver again. |
| 82 | +
|
| 83 | +[Ceph integration](https://docs.ceph.com/docs/master/man/8/rbd-nbd/) [`rbd-nbd`](https://github.com/cloudbase/ceph/tree/windows) |
| 84 | +-------------------------- |
| 85 | +
|
| 86 | +
|
| 87 | +Testing with NBD (Network Block Device) |
| 88 | +--------------------------------------- |
| 89 | +
|
| 90 | +We assume you are familiar with <a href="https://github.com/NetworkBlockDevice/nbd#using-nbd">using NBD</a>. |
| 91 | +
|
| 92 | + * `wnbd-client` syntax |
| 93 | + ``` |
| 94 | + PS C:\workspace> .\wnbd-client.exe |
| 95 | + Syntax: |
| 96 | + wnbd-client map <InstanceName> <HostName> <PortName> <ExportName> <DoNotNegotiate> |
| 97 | + wnbd-client unmap <InstanceName> |
| 98 | + wnbd-client list |
| 99 | + ``` |
| 100 | +
|
| 101 | + * NBD server configuration: |
| 102 | + ``` |
| 103 | + root@ubuntu-Virtual-Machine:/home/ubuntu# cat /etc/nbd-server/config |
| 104 | + [generic] |
| 105 | + # If you want to run everything as root rather than the nbd user, you |
| 106 | + # may either say "root" in the two following lines, or remove them |
| 107 | + # altogether. Do not remove the [generic] section, however. |
| 108 | + port = 9000 |
| 109 | + user = nbd |
| 110 | + group = nbd |
| 111 | + includedir = /etc/nbd-server/conf.d |
| 112 | + |
| 113 | + # What follows are export definitions. You may create as much of them as |
| 114 | + # you want, but the section header has to be unique. |
| 115 | + |
| 116 | + [foo] |
| 117 | + exportname = /blaz/bla.img |
| 118 | + port = 9000 |
| 119 | + copyonwrite = true |
| 120 | + root@ubuntu-Virtual-Machine:/home/ubuntu# ifconfig eth0 | grep 172 |
| 121 | + inet 172.17.160.251 netmask 255.255.255.240 broadcast 172.17.160.255 |
| 122 | + ``` |
| 123 | +
|
| 124 | + * Mapping an export: |
| 125 | + ``` |
| 126 | + PS C:\workspace> .\wnbd-client.exe map test2 172.17.160.251 9000 foo |
| 127 | + InstanceName=test2 |
| 128 | + HostName=172.17.160.251 |
| 129 | + PortName=9000 |
| 130 | + ExportName=foo |
| 131 | + MustNegociate=1 |
| 132 | + PS C:\workspace> Get-Disk |
| 133 | + |
| 134 | + Number Friendly Name Serial Number HealthStatus OperationalStatus Total Size Partition |
| 135 | + Style |
| 136 | + ------ ------------- ------------- ------------ ----------------- ---------- ---------- |
| 137 | + 0 Msft Virtual Disk Healthy Online 127 GB GPT |
| 138 | + 1 WNBD Dis WNBD_DISK_ID test2 Healthy Online 256 MB RAW |
| 139 | + ``` |
| 140 | +
|
| 141 | + * Listing the mapped device |
| 142 | + ``` |
| 143 | + PS C:\workspace> .\wnbd-client.exe list |
| 144 | + Status: 0 |
| 145 | + InstanceName Pid DiskNumber |
| 146 | + test2 6712 1 |
| 147 | + ``` |
| 148 | +
|
| 149 | + * Unmapping the device |
| 150 | + ``` |
| 151 | + PS C:\workspace> .\wnbd-client.exe unmap test2 |
| 152 | + PS C:\workspace> Get-Disk |
| 153 | + |
| 154 | + Number Friendly Name Serial Number HealthStatus OperationalStatus Total Size Partition |
| 155 | + Style |
| 156 | + ------ ------------- ------------- ------------ ----------------- ---------- ---------- |
| 157 | + 0 Msft Virtual Disk Healthy Online 127 GB GPT |
| 158 | + |
| 159 | +``` |
| 160 | +
|
| 161 | +What other documentation is available? |
| 162 | +-------------------------------------- |
| 163 | +
|
| 164 | +Build via docker |
| 165 | +
|
| 166 | +- [BUILD.Docker.md] |
| 167 | +
|
| 168 | +[BUILD.Docker.md]:Dockerfile/Readme.md |
0 commit comments