You are not logged in.

#1 2011-07-02 12:12:19

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

nbd config file

hi,

I'm kind of stuck with the nbd config file, it just doesn't work correctly.  It currently looks like this:

$ cat /etc/nbd-server/config
[generic]

[nbdexport]
exportname = /nbdfile
port = 1234

starting nbd via /etc/rc.d/nbd works fine, however, the expected export is not running. Instead I get:

$ netstat -tulpen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name   
tcp        0      0 0.0.0.0:10809           0.0.0.0:*               LISTEN      0          8746628    29192/nbd-server   

As you can see, nbd is running on port 10809 instead of 1234 and connecting doesn't work either:

$ nbd-client localhost 10809 /dev/nbd0
Negotiation: .Error: Not enough cliserv_magic
Exiting.

If I start nbd-server manually, everything works as expected.

nbd-server -C " " 1234 /nbdfile

I add a non-existent config file (-C) because otherwise nbd parses the config file as well.

What am I missing here? Is this a bug? I tried a lot of different options in the config but it simply never works as expected.

Offline

#2 2011-09-27 21:54:25

solamour
Member
Registered: 2011-09-14
Posts: 5

Re: nbd config file

I think if you are using nbd 2.9.17 or later, the port number becomes relevant only if "oldstyle" to set to true. Refer to "man 5 nbd-server" for more info.

[generic]
oldstyle = true    <--
[nbdexport]
exportname = /nbdfile
port = 1234

__
sol

Offline

#3 2013-04-03 13:14:38

b4283
Member
Registered: 2008-11-26
Posts: 121

Re: nbd config file

Okay, I just figured it out. If you use the "newstyle", then:

in /etc/nbd-server/config you would have sections like "export1", "export2" etc:

[generic]
...
[export1]
	exportname = /dev/disk/by-uuid/xxxxxxxxx

To mount "export1", you do this:

nbd-client <IP_ADDR> /dev/nbd0 -N export1

Offline

#4 2015-06-19 17:28:31

SteveSapolsky
Member
Registered: 2014-08-09
Posts: 16

Re: nbd config file

Does anybody figure out how to specify the port?

I have a weird behavior with `nbd-server` (3.10). If I specify the port, it still listens to a bunch of other ports. Only listening to the default port work for some reason.

~ sudo nbd-server localhost:9000 /dev/sdc
** (process:3121): WARNING **: Specifying an export on the command line is deprecated.

** (process:3121): WARNING **: Please use a configuration file instead.

Below you can see that it listens to a bunch of other ports, including the default one.

~ sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:55055           0.0.0.0:*               LISTEN      3122/nbd-server                
tcp        0      0 0.0.0.0:10809           0.0.0.0:*               LISTEN      3122/nbd-server     
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      3122/nbd-server             
tcp6       0      0 :::51489                :::*                    LISTEN      3122/nbd-server     
tcp6       0      0 ::1:9000                :::*                    LISTEN      3122/nbd-server   

My config file is simple:

[generic]
  user = nbd
  group = nbd
[otherexport]
    exportname = /dev/sdc
    #port = 9000

Of course, it prints a warning that specifying an export on the command line is deprecated. But without `/dev/sdc` argument it will ignore the port completely and listen to the default port.

~ sudo nbd-server localhost:9000
~ sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name         
tcp        0      0 0.0.0.0:10809           0.0.0.0:*               LISTEN      3171/nbd-server       

Running it without any arguments does work. It starts without warnings and it listens to only one port, as you can see below. Unfortunately that's not the port I want it to listen to:

~ sudo nbd-server
~ sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:10809           0.0.0.0:*               LISTEN      3222/nbd-server     

Switching to oldstyle protocol does not work:

~ sudo nbd-server
** Message: Since 3.10, the oldstyle protocol is no longer supported. Please migrate to the newstyle protocol.
** Message: Exiting.

the config for the command above ^ was

[generic]
  oldstyle=true
  user = nbd
  group = nbd
[otherexport]
    exportname = /dev/sdc
    port = 9000

Offline

#5 2015-06-19 17:59:21

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,371

Re: nbd config file

Please open a new topic about your problem, this topic is ancient.

https://wiki.archlinux.org/index.php/Fo … bumping.22

Closing.


Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Online

Board footer

Powered by FluxBB