A strategy for tackling NAS problems

Many of you report problems backing up to NAS systems, particularly with backups taking forever or throwing errors. Because there are so many systems and standards involved in backing up to network storage, it’s valuable to test simple functions before trying to tackle the whole series. This article proposes a series of simple tests which should help you gain clearer insights into any problem and eliminate causes one at a time.

What you need

To perform these tests, you need:

  • wired 1 Gb or better ethernet connections between your Mac and the NAS;
  • Stibium for performance testing;
  • The Time Machine Mechanic (T2M2) for the final test;
  • Time Machine backups already configured from the Mac to the NAS.

synol01

synol02

Ensure that your NAS operating system is fully up to date, and check its SMB and AFP configurations carefully. Your Mac should be running Monterey, preferably version 12.1. Previous versions of macOS may not achieve good performance, particularly when using SMB.

Test 1: Finder copy

This test measures the time that it takes to copy one file of 5-10 GB to the NAS, and copy it back again. To do that, create or borrow a single file of that size. Don’t use a bundle like an app unless it has been archive or compressed into a single file. If you wish, you can create a file of an exact size using Stibium: set the file size on the top line to 5 or 10 GB, and the contents to 0x41. Ensure the No Cache checkbox is ticked. Then click the Write Single… button at the top left, and choose where you want the file to be saved.

synol03

Set your menu bar clock to show seconds. As the seconds approach 55, drag the test file over a window on your shared folder on your NAS, releasing the file as the seconds reach 00. Watch for the moment that copying is complete, and the Finder’s progress window disappears. Work out the time taken in seconds, and calculate (file size in MB)/(seconds to transfer) to give the result in MB/s. Repeat by copying the file in the other direction, from the NAS to your Mac.

Target: over 1 Gb ethernet, the transfer speeds should be 70-100 MB/s. Below 50 MB/s suggests a sub-optimal SMB implementation, and below 30 MB/s suggests a serious misconfiguration which needs to be corrected before testing any further.

Test 2: Stibium

Stibium is designed to perform read and write tests on a wide range of storage media. Although originally developed to benchmark high-speed SSDs, it works even better on networked storage. This test works with files from 2 MB to 2 GB in size, so more typical of those likely to be transferred when backing up.

Before running this test, I create a folder on the share with a distinctive name such as 0stibiumTest in which to write the test files. This makes it easier to clean up afterwards.

Setting Stibium up is simple: set the middle popup menu to write 0x41 to the test files, ensure the number of repeats is set to 1, the No Cache checkbox is ticked, then click on the Write Series… button and select that folder on the share. When all the files have been written, the results will be shown in the lower view, and the write speed in the box above.

synol04

To perform the read test, leave those settings the same, click on the Read Folder… button, and select the folder containing the test files that Stibium just wrote. After a pause, the read results will be displayed.

Target: excellent results are higher than 90 MB/s; anything above 70 is good, but below 50 MB/s suggests a misconfiguration, and less than 30 MB/s is seriously bad.

Test 3: Time Machine

Once you’ve tuned your NAS to give consistently good results in the first two tests, you can try an incremental update in Time Machine, with the confidence that it should be able to run fairly briskly. With the aid of the Time Machine pane, wait until your Mac has just completed a backup. Then create some test files in one of the folders which it will back up. I normally use one file of 5-10 GB, and five of 1 GB. Unfortunately, as Time Machine to APFS can’t delete single files from old backups, these will inflate the size of your backups slightly, so don’t go too far and create many large files for the test.

Although you can run a manual backup, it’s better if you can leave Time Machine to make an automatic timed backup. Watch that complete in the Time Machine pane, leave it another couple of minutes to ensure all post-backup actions are complete, then open T2M2. Set it to check the last 1 hour, then click on the APFS button. You should see the following.

2021-12-24 15:36:01.099351+0000 Starting manual backup
gives the start time of that backup, which you’ll use to calculate the transfer rate.

2021-12-24 15:36:01.890126+0000 Mounted 'smb://hoakley@NAS40A892._smb._tcp.local/TMbackup1' at '/Volumes/.timemachine/NAS40A892._smb._tcp.local/B0169076-92E9-44A8-875A-18AF232B0469/TMbackup1' (4.34 TB of 4.36 TB available)
which marks the mounting of the share on the NAS. When this uses SMB, the URL shown will start with smb: If you see afp:, or an afp share, then SMB isn’t being used for that backup. All good NAS running current releases of their systems should now be able to make Time Machine backups over SMB. The only exceptions that I’ve come across are WD My Cloud systems, and TerraMaster products, which appear to be limited to AFP at present.

2021-12-24 16:24:15.986475+0000 Found matching sparsebundle 'Howard’s MacBook Pro.sparsebundle' with host UUID 'C3968125-C498-5CC1-A877-EF5077E373B8' and MAC address '(null)'
marks the discovery of the backup sparsebundle.

2021-12-24 16:30:33.997773+0000 Backup result: {
BackupStrategy = 2;
BlocksToCopy = 26969459;
BytesToCopy = 110466904064;
ClientID = "com.apple.backupd";
DestinationMountPoint = "/Volumes/Backups of Howard\U2019s MacBook Pro";
FreeBytes = 62812340224;
PaddedBytesRequired = 131941740544;
Progress = {
Percent = "0.4746672275186737";
TimeRemaining = "571.1035929594439";
"_raw_Percent" = "0.4746672275186737";
"_raw_totalBytes" = 110466904064;
bytes = 15071322112;
files = 759;
sizingFreePreflight = 1;
totalBytes = 110466904064;
totalFiles = 1194636;
};
Running = 1;
"com.apple.backupd.SnapshotTotalBytesCopied" = 15076720640;
}

declares the success of that backup. Use the figures given in the lines
bytes = 15071322112;
files = 759;

in your calculations, as they represent the actual data and file copying which took place in that backup.

2021-12-24 16:30:59.972978+0000 Completed backup: 2021-12-24-163029.backup
marks the time that the backup was completed.

To calculate the transfer rate, work out the number of seconds between the start and completion, and convert the bytes figure into MB by deleting the last six digits. In this case, the transfer rate is (transfer in MB)/(time in seconds) = 15071/405 = 37.2 MB/s.

Target: For a network backup over 1 Gb ethernet, anything over 40 MB/s is excellent, and anything under 30 MB/s is cause for concern.

Test 4: When backup slows to a crawl

With the first three tests complete, you may still observe that some backups slow to a crawl or choke completely. When this happens, open T2M2 and click on the Check Speed button. Scroll to the bottom of the text, and look at the last progress entry. It should appear something like
2021-12-21 18:41:09.817575+0000 .••••• .
Progress: 58% done, 0.0761%/s, 8.92 MB/s, avg: 31.83 MB/s, 205.09 items/s, avg: 77.39 items/s
FSPhysicalSize:82% (CV:67.52 GB/82.43 GB (D: Zero KB),T:82.43 GB,D:Zero KB(-),LA:Zero KB(-))Y
FSCompletedItems:35% (CV:155657/445403 (D: 0),T:445403,D:0(-),LA:0(-))Y
TTCompletedEventPaths:- ()N
Copied: 169697 (l:68.57 GB p:67.54 GB) Propagated: 0 (l:Zero KB p:Zero KB) Propagated (shallow): 0 (l:Zero KB p:Zero KB)
Tracker: FlCp:115937DrCp:39538SmCp:14040FlLn:67FlCl:115
Lookups:
Comparisons: Operations:
Backup Projected Stats: 1182393 items (p:120.19 GB)
Sized: l:37.66 GB p:21.86 GB c:736989, Outstanding:0/1531, Finished Volumes:0
Current: Zero KB/(l:15 KB,p:16 KB) - /Volumes/Backups of Howard’s MacBook Pro/2021-12-21-180529.inprogress/Data/Applications/iMovie.app/Contents/Frameworks/Flexo.framework/Versions/A/Resources/es_419.lproj/sports-player.png

Important contents include:
Progress: 58% done, 0.0761%/s, 8.92 MB/s, avg: 31.83 MB/s, 205.09 items/s, avg: 77.39 items/s
which gives the current transfer rate of 8.92 MB/s, the average of 31.83 MB/s, and equivalent figures for the number of items being transferred.
Current: Zero KB/(l:15 KB,p:16 KB) - /Volumes/Backups of Howard’s MacBook Pro/2021-12-21-180529.inprogress/Data/Applications/iMovie.app/Contents/Frameworks/Flexo.framework/Versions/A/Resources/es_419.lproj/sports-player.png
gives the path to the item currently being transferred.

If the transfer rate falls to less than 5 MB/s, make a note of the path of the item. One way to accelerate that backup is to add the folder containing items which cause slowing or choking to the list of exceptions in the Time Machine pane, so they aren’t backed up by Time Machine again. You can then make alternative arrangements for their backup, should that be necessary.

May all your backups be swift, speedy and robust!