How to make Samba tweaks reboot-proof? (smb.conf)

Questions and mods regarding system management may go here
Forum rules
Please note the disclaimer before modifying your Synology Product.

How to make Samba tweaks reboot-proof? (smb.conf)

Postby Sakkerju » Mon Apr 19, 2010 10:00 am

I use Samba shares to access my Synology DS209+II from Windows (7) environment.
For this, I prefer to have direct access to 'volume1' to view whole '/volume1' as a Samba shared folder
(Also possible to have it at / level, so you can acces the system partition too)

I configure this by manually adding an additional share in the Samba config file and restart Samba deamon via a Telnet session.
/usr/syno/etc/smb.conf
This works really great! I have a single share to access all my data files/folders (nice for moving files within folders via Windows)

However, the setting I make are lost after a reboot from the Synology.
It defaults back and restores the original setting in the smb.conf

- Can I make this more permanent (reboot-proof)?
- Should I update another .conf file somewhere?
Synology DS209+II - DSM 4.1 - WD Red 3TB (RAID1) *** Linksys WRT320N 1Gb *** Logitech Media Server 7.7.2
Squeezeboxes "Touch / Radio / Controller / Android App" *** WD TV Live Media Player *** UPC Horizon mediabox
User avatar
Sakkerju
Sharp
Sharp
 
Posts: 173
Joined: Wed Jan 20, 2010 12:35 pm
Location: Netherlands, Europe

Re: How to make Samba tweaks reboot-proof? (smb.conf)

Postby jarvis » Fri May 28, 2010 7:13 am

+1 for this

Originally posted in File Sharing forum, so mods feel free to move my post here:
http://forum.synology.com/enu/viewtopic.php?f=111&t=24788
...defiantly mixing and matching drive manufacturers to avoid getting 3 duff drives that fail in the same month...
DS410: Seagate Barracuda ST31000528AS, Hitachi Deckstar HDS721010CLA332, Samsung SpinPoint HD103SJ.
All 1TB capacity, 32Mb buffer in RAID5
Enjoying music streamed to my Linn Majik DS
jarvis
Apprentice
Apprentice
 
Posts: 99
Joined: Sun May 23, 2010 8:52 pm

Re: How to make Samba tweaks reboot-proof? (smb.conf)

Postby Sakkerju » Tue Jun 01, 2010 12:13 pm

There might not be just a simple way to solve this :roll:

I think this workaround is a way to solve this matter.
simply saving the smb.conf at shutdown and restoring it at startup...
Or maybe 'restarting' SMB AFTER startup....

/usr/local/etc/rc.d/S80samba.sh stop|start|restart

Then, modify original script i've sent you like:

Code: Select all
# ================== cut here =====
#!/bin/sh

# stop samba
/usr/local/etc/rc.d/S80samba.sh stop

# backup default smb.conf
cp /usr/syno/etc/smb.conf /usr/syno/etc/backup/smb.conf

# copy backup config file
cp /usr/syno/etc/bacup/smb.conf  /usr/syno/etc/smb.conf

# restart samba
/usr/local/etc/rc.d/S80samba.sh start
# ========================= cut here ==========


Pay attention, that you need to create a directory BACKUP in /usr/syno/etc/
Synology DS209+II - DSM 4.1 - WD Red 3TB (RAID1) *** Linksys WRT320N 1Gb *** Logitech Media Server 7.7.2
Squeezeboxes "Touch / Radio / Controller / Android App" *** WD TV Live Media Player *** UPC Horizon mediabox
User avatar
Sakkerju
Sharp
Sharp
 
Posts: 173
Joined: Wed Jan 20, 2010 12:35 pm
Location: Netherlands, Europe

Re: How to make Samba tweaks reboot-proof? (smb.conf)

Postby jarvis » Tue Jun 01, 2010 3:52 pm

Sakkerju wrote:I think this workaround is a way to solve this matter.
simply saving the smb.conf at shutdown and restoring it at startup...
Or maybe 'restarting' SMB AFTER startup....


I put my own script into the crontab file (nothing to do with this topic) but it didn't run at the appointed date/time. Checking back, the crontab file has also been reset after reboot - now the only lines are the ones added by DSM for time sync and shutdown! :lol:

So your tip might work if I run it manually every day, but I can't schedule it. Of course if I disable scheduled shutdown it would be fine probably.
...defiantly mixing and matching drive manufacturers to avoid getting 3 duff drives that fail in the same month...
DS410: Seagate Barracuda ST31000528AS, Hitachi Deckstar HDS721010CLA332, Samsung SpinPoint HD103SJ.
All 1TB capacity, 32Mb buffer in RAID5
Enjoying music streamed to my Linn Majik DS
jarvis
Apprentice
Apprentice
 
Posts: 99
Joined: Sun May 23, 2010 8:52 pm

Re: How to make Samba tweaks reboot-proof? (smb.conf)

Postby Sakkerju » Tue Jun 01, 2010 10:40 pm

jarvis wrote:So your tip might work if I run it manually every day, but I can't schedule it. Of course if I disable scheduled shutdown it would be fine probably.


I was thinking of creating a high Sxx script to start during startup, having it restore the pre-boot smb.conf and restart Samba.
Not tried it yet, but must be possible when linked to rc.d to autostart....
Synology DS209+II - DSM 4.1 - WD Red 3TB (RAID1) *** Linksys WRT320N 1Gb *** Logitech Media Server 7.7.2
Squeezeboxes "Touch / Radio / Controller / Android App" *** WD TV Live Media Player *** UPC Horizon mediabox
User avatar
Sakkerju
Sharp
Sharp
 
Posts: 173
Joined: Wed Jan 20, 2010 12:35 pm
Location: Netherlands, Europe

Re: How to make Samba tweaks reboot-proof? (smb.conf)

Postby n_brown » Mon Aug 16, 2010 8:35 pm

My approach to fixing this was to make the smb.conf file immutable. I had to add the 'chattr' program with ipkg (part of the e2fsprogs package), and then just set the smb.conf file as immutable with 'chattr +i /usr/syno/etc/smb.conf'.

-Nick
n_brown
I'm New!
I'm New!
 
Posts: 2
Joined: Mon Aug 16, 2010 8:31 pm


Return to System Managment Mods

Who is online

Users browsing this forum: No registered users and 4 guests