Mac Long-running network shares use SMB and Finder connection problems

Ok I’m trying to do something a little crazy. I want a reliable way to copy things and maintain checksums on long term backups. It’s a project that I’ve done off an on for a long time and it is nearly done!

Here are some notes:

  1. Rsync is a great utility for copying things. The parameters are tricky though, so it is best done in a script. But the best flags are -acP which means copy All, use a Checksum as opposed to just a file and date check and show a Progress bar. Using a checksum is good but slower, so perfect for archiving
  2. Hashdeep is a slow but useful utility. It goes through files and generates checksums for each and sticks them in a directory. You can then when copying compare to see if things have changed. It will also help eliminate disk errors. The options are more complicated but -c sha256 -rl is a good base which means use SHA256 as that’s harder to hack and then do the hashing recursively and make the paths in the hashdeep file relative.
  3. Hashdeep isn’t super convenient in that there isn’t a way just to compare two hashdeep files, no matter how you run it, you have to run a hash against something. Also, when you do the comparison, you need some more flags specifically -a -vv -k _hashfile_ which means run an audit and the the double v means show the results for bad hashes.
  4. The other problem is that there isn’t a restart option, so if you lose the network connection, it has to start all over which is pretty sad. You could write a program to look through every entry in the current hash file and then just look for things not there, but then you have to parse the hashdeep file which is a pain.

Now here come the tips and tricks.

Do not use AFP

  1. On one of my Mac’s I’ve had a long term problem with connections failing, I can see the network share, but it says Connection Failed and if you click on Connect As nothing happens. So no problem, just do it manually.
  2. So I normally just go to the Finder > Go > Connect to Server and then there is a funky url that looks like afp://your server_name.afpovertcp._tcp.local which means use the Apple File Protocol over TCP and then use TCP on the local network.
  3. Losing AFP Connection use SMB. The problem is that this network share would keep dropping connections. Apple has switched to the new SMB 2/3 protocol and AFP is unreliable, so the correct incantation is smb://your_server_name._smb._tcp.local
  4. Turn off Packet Signing. One small note is that on old MacOS, you have to turn off SMB packet signing, although new versions turn this off by default. This is a security hole, so you might want to turn it back on if your NAS supports it. It is a performance hit to turn it off though.
  5. Connect on Boot. I didn’t know this trick, but you can actually make a network a boot item so it will always connect there. Useful for desktop machines.
  6. You can also do this manually from the command line with the BSD utility mount_smbfs

Net, net programmatically, if you want to connect to a share and then wipe it out, mount_smbfs is the way to go

Why does the drive say not connected

Ok, so the last problem is why can’t I connect to the NAS and why does it say connection failed:

  1. Well, it’s likely that the stored password in Keychain is wrong. So start Keychain Chain Access and then search for the name of your NAS. You should find an entry of the “kind” network password and you can check it. Delete it or change it if it is wrong
  2. Relaunch Finder. First is that Finder appears to have problems and so if you see this, the only fix is to Option Right click on the Finder and then choose relaunch and you should be able to do this.

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect