Liam
2010-Dec-16 21:36 UTC
[Samba] Running a sleepy server (was: smbd on a battery-powered device)
On Wed, Dec 15, 2010 at 1:31 AM, Andrew Bartlett <abartlet at samba.org> wrote:> On Mon, 2010-12-13 at 12:37 -0800, Liam wrote: > > I'm setting up samba service on a battery-powered WiFi device. The > > plan is to have it wake-on-lan, handle request, sleep. Anyone have > > experience with this? > > > > Are there smb protocol aspects that preclude server sleep between > > client-initiated exchanges? > > > > My server won't be awake to respond to netbios broadcasts, e.g. for > > name resolution. Can I shut off that service, and have clients access > > \\192.168.0.10\share? Can I shut off everything but the smb session > > service? > > > > Alternatively I could start/stop the server on demand, since I know > > when a client wants a file via smb. Is samba startup efficient, or > > cpu/disk-intensive? > > The inetd mode would seem to be the best way to handle this. Then your > inetd or replacement can handle starting smbd. Just watch out that > clients may keep a connection open for quite some time while not > actually using it.Thanks for the input, Andrew. Can I disable nmbd if clients use \\192.168.0.1\share style addresses? And when an smb connection is active but the client is idle, does the client expect anything from the server? If not, the next client msg will trigger wake-on-lan and the connection will be fine...
Andrew Bartlett
2010-Dec-16 21:53 UTC
[Samba] Running a sleepy server (was: smbd on a battery-powered device)
On Thu, 2010-12-16 at 13:36 -0800, Liam wrote:> On Wed, Dec 15, 2010 at 1:31 AM, Andrew Bartlett <abartlet at samba.org> wrote: > > > On Mon, 2010-12-13 at 12:37 -0800, Liam wrote: > > > I'm setting up samba service on a battery-powered WiFi device. The > > > plan is to have it wake-on-lan, handle request, sleep. Anyone have > > > experience with this? > > > > > > Are there smb protocol aspects that preclude server sleep between > > > client-initiated exchanges? > > > > > > My server won't be awake to respond to netbios broadcasts, e.g. for > > > name resolution. Can I shut off that service, and have clients access > > > \\192.168.0.10\share? Can I shut off everything but the smb session > > > service? > > > > > > Alternatively I could start/stop the server on demand, since I know > > > when a client wants a file via smb. Is samba startup efficient, or > > > cpu/disk-intensive? > > > > The inetd mode would seem to be the best way to handle this. Then your > > inetd or replacement can handle starting smbd. Just watch out that > > clients may keep a connection open for quite some time while not > > actually using it. > > > Thanks for the input, Andrew. > > Can I disable nmbd if clients use \\192.168.0.1\share style addresses?Yes, or they use DNS names.> And when an smb connection is active but the client is idle, does the client > expect anything from the server? If not, the next client msg will trigger > wake-on-lan and the connection will be fine...If the client is truly idle, then it's down to what the TCP layer may or may not do (keep-alive etc). Also (but others who deal with the Samba3 code would be more qualified to comment) I think Samba when running will do a number of periodic tasks, which is just as likely to keep your box awake as the client itself. Andrew Bartlett
Liam
2010-Dec-16 22:36 UTC
[Samba] Running a sleepy server (was: smbd on a battery-powered device)
On Thu, Dec 16, 2010 at 1:52 PM, <tms3 at tms3.com> wrote:> On Thursday 16/12/2010 at 1:36 pm, Liam wrote: > > On Wed, Dec 15, 2010 at 1:31 AM, Andrew Bartlett <abartlet at samba.org> > wrote: > > On Mon, 2010-12-13 at 12:37 -0800, Liam wrote: > > I'm setting up samba service on a battery-powered WiFi device. The > plan is to have it wake-on-lan, handle request, sleep. Anyone have > experience with this? > > Are there smb protocol aspects that preclude server sleep between > client-initiated exchanges? > > My server won't be awake to respond to netbios broadcasts, e.g. for > name resolution. Can I shut off that service, and have clients access > \\192.168.0.10\share? Can I shut off everything but the smb session > service? > > Alternatively I could start/stop the server on demand, since I know > when a client wants a file via smb. Is samba startup efficient, or > cpu/disk-intensive? > > > The inetd mode would seem to be the best way to handle this. Then your > inetd or replacement can handle starting smbd. Just watch out that > clients may keep a connection open for quite some time while not > actually using it. > > ... > > And when an smb connection is active but the client is idle, does the > client > expect anything from the server? > > Well, it kinda depends on a lot of things. But a realistic instance: Say > a user opens a word doc, get an oplock, then goes home for the evening. > Well, Word expects that oplock is there, Windows expects it, and in my > experience a Samba server maintains it...soooo....that connection would be > open and running the next morning. > > That said, depending on the file type and what's oplocked etc...often > restarting smbd does little harm...often...but it depends on the type of > files shared. So perhaps you could pull information from smbstatus, and > restart smbd then sleep the server and wait for the client to decided to do > something...again though could be quite messy, just depends on what your use > is. >I don't actually need to *restart* samba, just sleep the device it's running on. All its state would persist until the next incoming message wakes it. But a sleepy server obviously won't send anything to the client, so I want to make sure that's not an issue.