nbdinfo [--json] [--map] [--size] NBD-URI nbdinfo -L|--list NBD-URI nbdinfo --help nbdinfo --version
$ nbdinfo nbd://localhost protocol: newstyle-fixed without TLS export="": export-size: 1048576 content: data is_rotational: false is_read_only: false can_cache: true can_df: true can_fast_zero: true can_flush: true can_fua: true can_multi_conn: true can_trim: true can_zero: true block_size_minimum: 1 block_size_preferred: 4096 block_size_maximum: 33554432
For an NBD server on a local Unix domain socket you would use a command such as this (with the same output as above):
$ nbdinfo "nbd+unix:///?socket=/tmp/unixsock"
$ nbdinfo --size nbd://localhost 1048576
$ nbdinfo --json nbd://localhost | jq { "protocol": "newstyle-fixed", "TLS": false, "exports": [ { "export-name": "", "content": "DOS/MBR boot sector; partition 1 : ID=0xc, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 2048, 4148704 sectors", "is_rotational": false, "is_read_only": true, "can_cache": true, "can_df": true, "can_fast_zero": false, "can_flush": false, "can_fua": false, "can_multi_conn": true, "can_trim": false, "can_zero": false, "block_size_minimum": 1, "block_size_preferred": 4096, "block_size_maximum": 33554432, "export-size": 2125119488 } ] }
$ nbdinfo --map nbd://localhost/ 0 1048576 0 allocated 1048576 1048576 3 hole,zero
The fields are: start, size, type, description (optional).
The type field is an integer showing the raw value from the NBD protocol. For some maps nbdinfo knows how to translate the type into a printable description.
To get parseable JSON output, add --json:
$ nbdinfo --map --json nbd://localhost/ [{ "offset": 0, "length": 1048576, "type": 0, "description": "allocated" }, { "offset": 1048576, "length": 1048576, "type": 3, "description": "hole,zero" }]
By default this shows the "base:allocation" map, but you can show other maps too:
$ nbdinfo --map=qemu:dirty-bitmap:bitmap nbd://localhost/ 0 1048576 1 dirty
For more information on NBD maps, see Metadata querying in the NBD protocol.
When not using --list, the default is --content, ie. probing the content. To prevent content probing, use --no-content.
When using --list, the default is --no-content (since downloading from each export is expensive). To enable content probing use --list --content.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA