Replacing the OS X 10.9 (Mavericks) SMB Stack with Samba3
A couple months back, I was excited to hear that Apple was working on a new SMB stack for their new operating system, OS X 10.9. However, once it finally hit, I realized that the new stack was even worse than the old one. I was unable to mount CIFS or SMB shares on our local storage cluster (a lovely 2 petabyte capacity Isilon cluster), getting error messages in system logs that looked like the following:
2/24/14 2:47:34.000 PM kernel: smb_smb_ssnsetup: HOSTNAME doesn’t support extended security, this server will be deprecated in the future!
I started to wonder if replacing Apple’s stack with the SMB stack provided by Sambawould be a good idea. It was. If you are using any storage appliance and have found that your SMB/CIFS access has been effectively cut off, or that it’s incredibly slow, read the following steps to replace your SMB stack in OS X.
- Install Homebrew – Using OS X as a sysadm has been mostly a blessing, but sometimes a curse. OS X has a great BSD based core and ships with many utilities found in other *nixes, but more than often those versions have various nuances that make me want to switch to the GNU provided versions. Homebrew allows you to download packages simply by running a ‘brew install programname’ in the Terminal. (After installing Homebrew, make sure you run a ‘sudo vim /etc/paths’ and move ‘/usr/local/bin’ to the top. This places /usr/local/bin in a higher priority when your system searches your $PATH for whatever binary you’re trying to execute.
- Once you have Homebrew installed (make sure you run ‘brew doctor’ to ensure all dependencies are installed)
- Next, install the Homebrew provided version of Samba. Currently, the version is at 3.6.20 (the command should be ‘brew install samba’)
- Homebrew will install this version of Samba to /usr/local/Cellar/samba/3.6.20 — if you aren’t familiar with the history of the /usr/local directory, read this) (if you understand the purpose of /usr/local, you’ll realize that installing here is completely safe and will not overwrite any of your operating system’s components). Homebrew creates a symlink to any binaries made in the /usr/local/bin and /usr/local/sbin folders.
- Next, we need to unload Apple’s netbios and samba daemons (Daemons is another term for services in the *nix world).
sudo launchctl stop com.apple.netbiosd
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist
- Next, we need to create plist files that point to the new versions of smbd andnmbd. These files will need to be created in /Library/LaunchDaemons/ — the contents and names of the files should be match the following (notice the location of the smbd and nmbd binaries — /usr/local/sbin/, where smbd and nmbd are symlinked to their respective binaries at /usr/local/Cellar/samba/3.6.20):
org.samba.nmbd.plist (I’m currently experimenting with the -D and -F flags for both of these services. For a description of the flags, check out the man pages for the respective service)
- Now that you have the services’ plist files ready, go ahead and launch them.
sudo launchctl load /Library/LaunchDaemons/org.samba.smbd.plist
sudo launchctl load /Library/LaunchDaemons/org.samba.nmbd.plist
- If you don’t have any shares currently open, the changes should take effect immediately. However, I highly suggest a restart after this process.
- Enjoy your new SMB3 stack! Immediately I noticed MUCH faster transfer speeds. Example: Grabbed a 900MB ISO off of a share in 6 seconds!
Plaats een ReactieMeepraten?
Draag gerust bij!