.\" Automatically generated by Podwrapper::Man 1.6.1 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "nbdinfo 1" .TH nbdinfo 1 "2021-02-09" "libnbd-1.6.1" "LIBNBD" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" nbdinfo \- display information and metadata about NBD servers and exports .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& nbdinfo [\-\-json] [\-\-map] [\-\-size] NBD\-URI \& \& nbdinfo \-L|\-\-list NBD\-URI \& \& nbdinfo \-\-help \& \& nbdinfo \-\-version .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" nbdinfo displays information and metadata about an \s-1NBD\s0 server. The only required parameter is the \s-1NBD URI\s0 of the server (see https://github.com/NetworkBlockDevice/nbd/blob/master/doc/uri.md): .PP .Vb 10 \& $ 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 .Ve .PP For an \s-1NBD\s0 server on a local Unix domain socket you would use a command such as this (with the same output as above): .PP .Vb 1 \& $ nbdinfo "nbd+unix:///?socket=/tmp/unixsock" .Ve .SS "Size" .IX Subsection "Size" To display only the size in bytes of the \s-1NBD\s0 export (useful for scripting) use the \fI\-\-size\fR parameter: .PP .Vb 2 \& $ nbdinfo \-\-size nbd://localhost \& 1048576 .Ve .SS "\s-1JSON\s0 output" .IX Subsection "JSON output" To display the output as \s-1JSON\s0 (eg. for scripting with \fBjq\fR\|(1)) add the \fI\-\-json\fR parameter: .PP .Vb 10 \& $ 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 \& } \& ] \& } .Ve .SS "Map" .IX Subsection "Map" To show a map of which areas of the disk are allocated and sparse, use the \fI\-\-map\fR option: .PP .Vb 3 \& $ nbdinfo \-\-map nbd://localhost/ \& 0 1048576 0 allocated \& 1048576 1048576 3 hole,zero .Ve .PP The fields are: start, size, type, description (optional). .PP The type field is an integer showing the raw value from the \s-1NBD\s0 protocol. For some maps nbdinfo knows how to translate the type into a printable description. .PP To get parseable \s-1JSON\s0 output, add \fI\-\-json\fR: .PP .Vb 5 \& $ nbdinfo \-\-map \-\-json nbd://localhost/ \& [{ "offset": 0, "length": 1048576, \& "type": 0, "description": "allocated" }, \& { "offset": 1048576, "length": 1048576, \& "type": 3, "description": "hole,zero" }] .Ve .PP By default this shows the \f(CW"base:allocation"\fR map, but you can show other maps too: .PP .Vb 2 \& $ nbdinfo \-\-map=qemu:dirty\-bitmap:bitmap nbd://localhost/ \& 0 1048576 1 dirty .Ve .PP For more information on \s-1NBD\s0 maps, see \fIMetadata querying\fR in the \s-1NBD\s0 protocol. .SS "List all exports" .IX Subsection "List all exports" To list all the exports available on an \s-1NBD\s0 server use the \fI\-\-list\fR (\fI\-L\fR) option. .SS "Alternative tools" .IX Subsection "Alternative tools" You could use \f(CW\*(C`qemu\-img info\*(C'\fR (see \fBqemu\-img\fR\|(1)) to query a single export from an \s-1NBD\s0 server. \f(CW\*(C`qemu\-nbd \-L\*(C'\fR (see \&\fBqemu\-nbd\fR\|(8)) can list \s-1NBD\s0 exports. \fBnbdsh\fR\|(1) or the \fBlibnbd\fR\|(3) \&\s-1API\s0 can be used for more complex queries. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Display brief command line help and exit. .IP "\fB\-\-content\fR" 4 .IX Item "--content" .PD 0 .IP "\fB\-\-no\-content\fR" 4 .IX Item "--no-content" .PD Mostly the information displayed comes from the metadata sent by the \&\s-1NBD\s0 server during the handshake. However nbdinfo also downloads a small amount of data from the beginning of the export to try to probe the content with \fBfile\fR\|(1). .Sp When \fInot\fR using \fI\-\-list\fR, the default is \fI\-\-content\fR, ie. probing the content. To prevent content probing, use \fI\-\-no\-content\fR. .Sp When using \fI\-\-list\fR, the default is \fI\-\-no\-content\fR (since downloading from each export is expensive). To enable content probing use \fI\-\-list \-\-content\fR. .IP "\fB\-\-json\fR" 4 .IX Item "--json" The output is displayed in \s-1JSON\s0 format. .IP "\fB\-\-map\fR" 4 .IX Item "--map" .PD 0 .IP "\fB\-\-map=\fR\s-1MAP\s0" 4 .IX Item "--map=MAP" .PD Display the map (usually whether parts of the disk are allocated or sparse) of the given export. This displays the \f(CW"base:allocation"\fR map by default, you can choose a different map with the optional parameter. .IP "\fB\-L\fR" 4 .IX Item "-L" .PD 0 .IP "\fB\-\-list\fR" 4 .IX Item "--list" .PD List all the exports on an \s-1NBD\s0 server. The export name in the \s-1NBD URI\s0 is ignored. .IP "\fB\-\-size\fR" 4 .IX Item "--size" Display only the size in bytes of the export. .IP "\fB\-V\fR" 4 .IX Item "-V" .PD 0 .IP "\fB\-\-version\fR" 4 .IX Item "--version" .PD Display the package name and version and exit. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBlibnbd\fR\|(3), \&\fBnbdcopy\fR\|(1), \&\fBnbdfuse\fR\|(1), \&\fBnbdsh\fR\|(1), \&\fBfile\fR\|(1), \&\fBjq\fR\|(1), \&\fBqemu\-img\fR\|(1), \&\fBqemu\-nbd\fR\|(8). .SH "AUTHORS" .IX Header "AUTHORS" Richard W.M. Jones .PP Eric Blake .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2020 Red Hat Inc. .SH "LICENSE" .IX Header "LICENSE" This library is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This library is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 Lesser General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA 02110\-1301 USA\s0