Fixing slow MacOS Finder on Samba file share, optimizing for Windows clients

If you are trying to figure out why your MacOS Finder is slow when it connects to a Samba file share on a Linux server, you are in the right place.

I found the solution in this post:

https://medium.com/@augusteo/fixing-slow-macos-finder-connection-to-linux-samba-server-ed7e5ea784c1

Here is what you need to add to /etc/samba/smb.conf on the Samba server:

vfs objects = fruit
fruit:aapl = yes
fruit:encoding = native
fruit:locking = none
fruit:metadata = stream
fruit:resource = file

While I was searching for things that could speed up a MacOS Finder client’s session, I found a number of optimizations that helped speed Windows clients connected to a Samba file share.

The best of these was a post:

https://eggplant.pro/blog/faster-samba-smb-cifs-share-performance/

with these suggestions for /etc/samba/smb.conf on the Samba server:

[global]

# FORCE THE DISK SYSTEM TO ALLOCATE REAL STORAGE BLOCKS WHEN
# A FILE IS CREATED OR EXTENDED TO BE A GIVEN SIZE.
# THIS IS ONLY A GOOD OPTION FOR FILE SYSTEMS THAT SUPPORT
# UNWRITTEN EXTENTS LIKE XFS, EXT4, BTRFS, OCS2.
# IF YOU USE A FILE SYSTEM THAT DOES NOT SUPPORT UNWRITTEN
# EXTENTS, SET "strict allocate = no".
# NOTE: MAY WASTE DRIVE SPACE EVEN ON SUPPORTED FILE SYSTEMS
# SEE: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798532

   strict allocate = Yes

# THIS IS TO COUNTERACT SPACE WASTAGE THAT CAN BE 
# CAUSED BY THE PREVIOUS OPTION 
# SEE: https://lists.samba.org/archive/samba-technical/2014-July/101304.html

   allocation roundup size = 4096

# ALLOW READS OF 65535 BYTES IN ONE PACKET.
# THIS TYPICALLY PROVIDES A MAJOR PERFORMANCE BENEFIT.

   read raw = Yes

# SERVER SIGNING SLOWS THINGS DOWN WHEN ENABLED.
# THIS WAS DISABLED BY DEFAULT PRIOR TO SAMBA 4.
# Thanks to Joe in the comments section!

   server signing = No

# SUPPORT RAW WRITE SMBs WHEN TRANSFERRING DATA FROM CLIENTS.

   write raw = Yes

# WHEN "strict locking = no", THE SERVER PERFORMS FILE LOCK
# CHECKS ONLY WHEN THE CLIENT EXPLICITLY ASKS FOR THEM.
# WELL-BEHAVED CLIENTS ALWAYS ASK FOR LOCK CHECKS WHEN IT IS
# IMPORTANT, SO IN THE VAST MAJORITY OF CASES,
# "strict locking = auto" OR "strict locking = no" IS ACCEPTABLE.

   strict locking = No

# TCP_NODELAY:
#    SEND AS MANY PACKETS AS NECESSARY TO KEEP DELAY LOW
# IPTOS_LOWDELAY:
#    [Linux IPv4 Tweak] MINIMIZE DELAYS FOR INTERACTIVE TRAFFIC
# SO_RCVBUF:
#    ENLARGE SYSTEM SOCKET RECEIVE BUFFER
# SO_SNDBUF:
#    ENLARGE SYSTEM SOCKET SEND BUFFER

   socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

# SMBWriteX CALLS GREATER THAN "min receivefile size" WILL BE
# PASSED DIRECTLY TO KERNEL recvfile/splice SYSTEM CALL.
# TO ENABLE POSIX LARGE WRITE SUPPORT (SMB/CIFS WRITES UP TO 16MB),
# THIS OPTION MUST BE NONZERO.
# THIS OPTION WILL HAVE NO EFFECT IF SET ON A SMB SIGNED CONNECTION.
# MAX VALUE = 128k

   min receivefile size = 16384

# USE THE MORE EFFICIENT sendfile() SYSTEM CALL FOR EXCLUSIVELY
# OPLOCKED FILES.
# NOTE: ONLY FOR CLIENTS HIGHER THAN WINDOWS 98/Me

   use sendfile = Yes

# READ FROM FILE ASYNCHRONOUSLY WHEN SIZE OF REQUEST IS BIGGER
# THAN THIS VALUE.
# NOTE: SAMBA MUST BE BUILT WITH ASYNCHRONOUS I/O SUPPORT

   aio read size = 16384

# WRITE TO FILE ASYNCHRONOUSLY WHEN SIZE OF REQUEST IS BIGGER
# THAN THIS VALUE
# NOTE: SAMBA MUST BE BUILT WITH ASYNCHRONOUS I/O SUPPORT

   aio write size = 16384

 

 

Operating systems and freedom: deep thoughts on replacing a cell phone

In 2014, I was in Alaska, and wanted to use a Red Pocket SIM card with my iPhone 4 to roam with a lot of data — 3GB was included in the package. I ordered the SIM card, installed it (with some difficulty), and was able to connect voice, text, and data to the local AT&T cell network. However, my personal hotspot for wifi tethering was disabled. I made a point of replacing the iPhone with  a hackable Android phone, the Google Nexus 5. The software environment on the Nexus 5 is ideal, but the hardware died early. I then got a Oneplus One, which is now in its 3rd year of service. Both the Nexus and the Oneplus were unlocked, and i reflashed both of them with rooted versions of Android. I then had the ability to use a SIM card and to edit various registries that control things like whether tethering is permitted on a prepaid SIM. As it turned out, I only used this capability once — on a trip in 2015. After that time, roaming plans for Canadian cell phones have improved considerably.

I had planned to replace my Oneplus One with a Oneplus 6 in July of this year (2018). However, Google’s war with Amazon has produced some collateral damage: Google apps will no longer run on unofficial builds of the Android kernel. There is a mechanism for registering as a developer, but the point is, I would be better off at that point by staying with stock OTA updates and a non-rooted image on an Android phone.

Google picked a bad time to do this: rumors are that a cheaper 6.1″ LCD iPhone will be released in September 2018, at US$550 (C$720). If an iPhone only costs C$60 more than a OnePlus 6, I may as well just buy the iPhone. I have been lusting after wifi calling, call handoff to the iPad, and Airplay to the Apple TV.

This got me to thinking about vendor lockin. Microsoft is trying to get things to go through their app store, if they follow the MacOS path this will soon be the default, and we could see a potential future where apps are locked down fully on Windows and MacOS.

Where does that leave freedom? The multiple-boot partition that runs Linux on my personal laptop is in many ways the last place I will truly be free to control my own computer. I used to see Linux as a great server and a mediocre desktop. I now see it as a free desktop, free as freedom, not simply free as in beer.

A picture of a cat with an iPad

My friend Jim is in town to attend to some family business, he brought his cat Lucky. This is the first blog post I have been able to tag under both the “iPad” and “Cats” categories.

 

Enabling SMB1 so Windows 10 can act as a file share server or client with non-Windows devices

Note: there are many things you need to check to get a Windows share working: whether network discoverability is enabled, ensuring that the firewall zone is set to private, and other advanced sharing options. This blog post assumes you have solved all of those problems, and have a Windows computer act as an SMB server, with a file share that is visible to other Windows computers, but is not visible to non-Windows clients. This blog post also applies if you have a Windows computer that is able to act as an SMB client to access a share on another Windows computer, but is unable to access a file share on a non-Windows device acting as an SMB server. Even if your Windows share does not yet work, it is probably worth your time to perform the steps outlined in this blog post.

Windows 10 includes a feature called File and Print Sharing that allows for a folder on a computer’s hard drive to be shared with other computers on a network. This kind of file sharing is called Server Message Block (SMB) and is implemented in non-Windows products, both hardware and software, in order to allow interoperability. Some hardware appliances, and some software, like the MacOS and Linux operating systems, as well as specialized programs like VLC running on iPad/iPhone, iOS, or TVOS (Apple TV) are able to act as SMB clients, so they can access files stored on a Windows-style share. Windows can also access shares on non-Windows devices using the SMB protocol.

This feature has been modified recently by security patches intended to harden the Windows 10 operating system against security threats like the WannaCry virus. There are several versions of the SMB protocol. The SMB 1.0/CIFS version of the protocol is now disabled by default. In addition, 3 rules were added to the Windows firewall that had the effect of blocking port 445, which is used by the SMB protocol. While it is fine to disable a firewall during initial troubleshooting, it is better for the long-term to re-enable the firewall, while disabling the rules that prevent SMB file sharing.

This means that if you have a share on Windows that is visible to other Windows computers, but not to non-Windows clients such as Mac, Linux, or hardware appliances, VLC, or Kodi, you may have to re-enable SMB 1.0/CIFS support in Windows 10. This may also apply if you are trying to use Windows as an SMB client to connect to an SMB share on a non-Windows device and are unable to do so, despite being able to connect to shares hosted on Windows computers.

Removing firewall rules re port 445

You may also have to disable certain firewall rules that were added by the security patch, specifically those that deal with port 445 for File and Print Sharing. From the Start menu, type “firewall,” then click on the option for “Windows Defender Firewall with Advanced Security. On the left side menu, select “Inbound Rules.” Locate the 3 rules labeled “File and Print Sharing (SMB-In). Highlight all 3 rules, right-click, then click “Disable rule.” On the left side menu, select Outbound Rules.” Locate the 3 rules labeled “File and Print Sharing (SMB-Out). Highlight all 3 rules, right-click, then click “Disable rule.”

Enabling SMB 1.0/CIFS protocol

To enable SMB 1.0/CIFS on a Windows 10 computer, go to the Start menu, type “windows feature,” then click on the option “Turn Windows features on or off.” You will then be presented with the following dialog:

Ensure that SMB 1.0/CIFS File Sharing Support and its sub-options are selected. Press OK. You will be prompted to reboot your computer. After you reboot, it is more likely that your share will be visible to non-Windows SMB clients, as before the security update. It is also more likely that your Windows computer will be able to connect as an SMB client to an SMB share on a non-Windows device.

Bluetooth shower speaker

My brother just gave me an advance birthday present, the Vic Tsing Bluetooth Shower Speaker.

The name says it all, here are some pictures:

On weekdays, my morning starts really early and i like to listen to the radio for traffic and weather while in the shower, or while shaving. However I can’t really hear the sound from the shower, and I do not like the idea of exposing my ipad to humidity.

So this devices should work out really well, the plan is to start a radio stream on the ipad, then send it to the speaker via bluetooth, from another room.

 

Followup: using VLC on the Apple TV to play media files stored on a local server

Now that VLC allows Apple TV to play stored media files, Apple TV is now a “twofer” that can replace either a Roku for streaming or Kodi for the playback of media files. As a bonus, Apple TV permits Apple-specific things like Airplay and access to iTunes purchases.

Apple TV remote control

The VLC developers did a good job of adapting the VLC interface and options to the “ten foot interface” paradigm with a remote control. Before we go any further, let’s talk about the Apple TV 4th generation’s remote control: it relies on a touchpad area at the top of the remote control that allows for gestures and swiping with your fingers, and its touchpad surface is clickable like a mouse. This is useful for “scrubbing” which is a technical term for moving the slidey thing to different parts of the media file.

File listing limitations

There is only one style available for the presentation of media files, as a set of rectangles, some with cover art, showing file names such as “show 1080p S01E11…mkv” with the title shortened to fit. Depending on how a file is named, this can cut off important information, such as the episode number.

Subtitles shown by default

If subtitles exist within a media file or externally as a subtitles file in the same directory, VLC will always show the subtitles by default. This can be annoying. In order to play a file with subtitles disabled, tap lightly on the touchpad to show the progress bar, then swipe down to show the subtitle menu while video keeps playing.

Subtitle download feature [Update: 20180816 subtitle download fixed at some point since this post]

The VLC “Track Selection” menu has an option to download subtitles for video files from an Internet service.

A pause bug has been fixed.

[Update: 2018/04/07 VLC on Apple TV has been updated and a bug in the pause/resume feature has now been fixed.] I am now able to recommend VLC on Apple TV as a replacement for Kodi as a media player for video and audio files stored on a local network file server.

Update 2018/03/27: You may find the following post of interest: “Streaming or downloading video files from a home network server to an iPad using VLC

Using VLC to play media files stored on a local file server

VLC is free software that is able to play most audio or video files, and can access those files from a local file server on a network.

I’ve used VLC for a long time, first on Windows and Linux laptops, then on my iPad, on my Android phone, and most recently, as an app on the Apple TV media player.

When I use VLC on my iPad, I either copy the file to VLC’s data area using its own built-in web server, or I access the content by connecting to a share on a local file server.  The server does not technically have to be local: I was able to mount a drive over a vpn connection from a hotel room while on vacation, but in practical terms, the server should be local, that is, on the same local Ethernet or wifi network as the device running VLC to play back its content.

I was able to run VLC on a laptop, and browse and play video files stored on a local file server, while using my Android phone as a remote control using a vlc remote control app.

I have just received an advance birthday present – a new Apple TV 4th generation media player (1080p 32GB). The Apple TV media player has the ability to load apps from the App Store, including VLC. (The Apple TV device will probably get its own blog post soon.)

I was pleasantly surprised that the VLC app on the Apple TV allowed me to browse and stream video and audio files stored on a Samba share (Windows-style network drive) on my home Linux server.

Update 2018/03/27: You may be interested in this post: “Followup: using VLC on the Apple TV to play media files stored on a local server,”

and this post: “Streaming or downloading video files from a home network server to an iPad using VLC