1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

NAS200 and Windows 7 offline files

Discussion in 'Cisco/Linksys Network Storage Devices' started by griffag, Feb 15, 2010.

  1. griffag

    griffag Addicted to LI Member

    Hi,

    I just upgraded to Windows 7 from XP, and can no longer get offline files to work with my NAS200. I've read in other forums about changing the oplocks setting, but can't seem to get that to work. I installed the JAC4 firmware, and tried to edit the /harddisk/volume_1/conf/smb.conf file to adjust the oplocks settings. When I restart the NAS, it doesn't look like it's loading the smb.conf file from that location. If I open the file in /etc/samba/smb.conf file, it doesn't show my changes.

    Did I miss a step in modifying the smb.conf file? I tried to edit the version in /etc.default but it is read-only.

    Thank you very much for any help!!
    -Adam
     
  2. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Oops, it appears you are right. The file in the config partition is used for backup...

    Looks like you will just have to use a script to make your changes persistent across reboots: /etc/ is mounted in RAM and what happens is that /etc.default/samba/smb.conf (and the other files from /etc.default) get copied to /etc during bootup, and rc.bootbin (Linksys/Sercomm's binary configuration parser) makes the necessary changes to the file in /etc/samba and adds the files in /etc/smb which are included.

    The smb.conf tries to include /etc/samba/user_smb.conf which doesn't exist, so you could just write extra options there from a script, but I haven't tried that. I do have a script that disables the "use sendfile" option (I forgot why) which you can adapt to your needs as follows:

    Code:
    #!/bin/sh
    #
    # Save this as /harddisk/volume_*/data/rc.d/rc.sambaoptions.
    # (the number behind volume_ depends on your configuration)
    #
    sed -i -e '/use sendfile/ s/yes/no/' /etc/samba/smb.conf
    sed -i -e '/oplocks/ s/no/yes/' /etc/samba/smb.conf
    
    As I said, in theory you should be able to do this (untested!)
    Code:
    #!/bin/sh
    #
    # Save this as /harddisk/volume_*/data/rc.d/rc.oplockson
    #
    echo "oplocks = yes" >>/etc/samba/user_smb.conf
    
    Let us know if it works!

    ===Jac

    PS to do a quick test without the need to reboot the NAS, you can type the echo command on a command line and then run /etc/rc.d/rc.samba. You don't need to (re)start the samba server from the script because it hasn't been started yet at the time that the script runs.
     
  3. griffag

    griffag Addicted to LI Member

    Thanks so much for your help! Am I understanding correctly that the NAS will automatically execute the script /harddisk/volume_*/data/rc.d/rc.oplockson when it boots?
     
  4. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    My firmware does, yes.

    ===Jac
     
  5. griffag

    griffag Addicted to LI Member

    It works!

    This seems to have solved the problem. My files are now syncing! My script includes a few more lines, based on the instructions mentioned in a previous message in this thread, so the final script is:


    #!/bin/sh
    #
    echo "oplocks = yes" >>/etc/samba/user_smb.conf
    echo "level2 oplocks = yes" >>/etc/samba/user_smb.conf
    echo "kernel oplocks = no" >>/etc/samba/user_smb.conf
    echo "create mask = 777" >>/etc/samba/user_smb.conf
    echo "map archive = yes" >>/etc/samba/user_smb.conf
    echo "map system = yes" >>/etc/samba/user_smb.conf
    echo "map hidden = yes" >>/etc/samba/user_smb.conf
     
  6. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Awesome! Thanks for the info.

    Note, not all users will want the same options in their scripts, for example the "create mask = 777" seems inappropriate if you want to keep housemates away from your data.

    My script also adds "use sendfile = no". From what I remember, this is supposed to make Samba go easier on memory usage, but I may be wrong.

    If you decide to change Samba options this way, please make sure to read the man page thoroughly.

    ===Jac

    PS I will add this to the FAQ.
     

Share This Page