I’ve had a Synology NAS for a very agelong time, and precocious I started moving its contents to a caller Ubiquiti UniFi UNAS Pro 8. This seemed for illustration it ought to beryllium a reasonably boring operation. Both devices speak SMB, I person a accelerated web (recently upgraded to 10 gigabit internally), and Windows has had devices for copying files reliably betwixt machines for decades. Naturally, it turned into a full evening of learning things I thought I already knew, which is why I started a blog lol.
There was a bully spot of history present for maine because backmost successful 2007 (good lord!) I wrote a station called “XCopy considered harmful - Robocopy aliases XXCopy aliases SyncBack.” My statement astatine the clip was fundamentally that erstwhile you are moving capable files, Explorer stops being the move and Robocopy starts looking beautiful good. I moreover utilized /Z, Robocopy’s restartable mode, because being capable to resume a partially transferred record was useful connected unreliable connections.
Almost 20 years later, /Z turned retired to beryllium 1 of the astir important things I needed to region because it made everything hella slow.
The migration
The basal occupation was straightforward. I had shares connected the Synology specified as:
\\server\musicand matching shares connected the UNAS:
\\UNAS-Pro-8\musicI initially utilized Explorer, mostly because it was location and because sometimes the easy point really is the easy thing. That lasted until Explorer started producing errors connected individual files:
The requested cognition could not beryllium completed owed to a record strategy limitationMy first thought was filenames. NAS migrations are afloat of opportunities to observe that 1 filesystem is much permissive than another, and location were filenames pinch parentheses and different punctuation successful them.
Then this failed:
\\server\music\Athlete\Tourist\05 Wires.m4pThere is thing particularly exotic astir 05 Wires.m4p, truthful I moved complete to Robocopy to get a small much information. It consistently sewage to 92% and returned Windows correction 665:
92% New File 4.3 m 05 Wires.m4p ERROR 665 (0x00000299) Copying File The requested cognition could not beryllium completed owed to a record strategy limitationAt this constituent the useful mobility was nary longer “what is incorrect pinch that filename?” but “which portion of the way is refusing this file?”
I copied the record from the Synology to my section Windows desktop. That worked. I past copied the section record from Windows to the UNAS, and that grounded pinch the aforesaid filesystem limitation.
That isolated the problem truthful the Synology could publication the file, Windows could shop it, and thing astir penning this peculiar record to the UNAS was causing trouble.
Alternate Data Streams, again
NTFS files tin incorporate named Alternate Data Streams successful summation to the mean unnamed watercourse that we usually deliberation of arsenic the contents of a file. This is an aged Windows filesystem feature, and it happens to beryllium 1 I wrote astir successful 2007 erstwhile discussing Zone.Identifier, which Windows tin usage to grounds wherever a downloaded record came from. I moreover blogged astir Alternate Data Streams successful 2003!!! Windows tin expose these streams pinch DIR /R.
So I ran:
dir /r "%USERPROFILE%\Desktop\05 Wires.m4p"and got:
11/30/2011 02:17 PM 4,576,368 05 Wires.m4p 360,456 05 Wires.m4p:01APIC_03.jpg:$DATAThere it is. Alongside the normal 4.5 MB euphony record was a astir 360 KB named information watercourse called 01APIC_03.jpg.
That besides explained the unusual 92% failure. Robocopy was successfully getting done the main contents of the record and past encountering the further stream. What had looked for illustration a nonaccomplishment location successful the mediate of an mean .m4p record was really occurring erstwhile Windows attempted to woody pinch the further filesystem data.
Robocopy has support for precisely this situation. Microsoft documents X arsenic 1 of the /COPY flags, meaning “skip alternate information streams.” So:
/COPY:DATXmeans transcript the file’s data, attributes, and timestamps, but do not transcript the alternate streams. /DCOPY:DATX applies the corresponding behaviour to directories. I retried the aforesaid file:
robocopy "\\server\music\Athlete\Tourist" "\\UNAS-Pro-8\music\Athlete\Tourist" "05 Wires.m4p" /R:0 /W:0 /COPY:DATX /DCOPY:DATX /Vand it completed successfully. The important favoritism present is that DATX does not region metadata stored inside an MP3, M4A, M4P, JPEG, aliases different record format. It tells Robocopy not to reproduce abstracted filesystem streams associated pinch the file. In my lawsuit those other streams were not thing I needed to sphere connected the caller NAS.
The transcript worked, but it was slow
Once the ADS rumor was understood, I started the larger migration pinch a reasonably conventional-looking Robocopy command:
robocopy "\\server\music" "\\UNAS-Pro-8\music" /E /Z /MT:16 /R:2 /W:2 /COPY:DATX /DCOPY:DATX /XJ /TEE /LOG:"%USERPROFILE%\Desktop\synology-to-unas.log"It ran, but capacity was each complete the place. Sometimes I would spot a fewer 100 megabits per second, past it would driblet dramatically. A mini record could look to beryllium location for a agelong time. I started wondering whether I was looking astatine buffering, slow disks, parity calculations, SMB behaviour connected the UNAS, aliases possibly my Synology had yet reached its limits.
So now it's "just effort random worldly (bisect)" time. I reduced the number of threads. I tried azygous threaded. None of that helped. Then I removed /Z.
Microsoft’s Robocopy archiving describes /Z arsenic restartable mode, which lets an interrupted record resume alternatively than starting again from byte zero. What I had forgotten is that Microsoft’s existent migration guidance specifically warns that /Z should beryllium utilized cautiously because the other logging required for restartability tin importantly trim transcript performance.
My successful euphony tally ended up using:
robocopy "\\server\music" "\\UNAS-Pro-8\music" /E /MT:4 /R:2 /W:2 /COPY:DATX /DCOPY:DATX /XJ /TEE /LOG:"%USERPROFILE%\Desktop\synology-to-unas-DATX.log"The summary from that tally was:
Total Copied Skipped Mismatch FAILED Files : 15940 6991 8949 0 0 Bytes : 70.907 g 47.917 g 22.989 g 0 0 Speed : 187,185,171 Bytes/sec.So the tally that copied almost 48 GB of remaining information averaged astir 187 MB/sec, pinch nary grounded files.
This was not a controlled benchmark wherever I changed precisely 1 adaptable while everything other remained identical, truthful I’m not going to dress the number proves that /Z accounted for each spot of the earlier slowdown. The applicable quality was ample enough, however, that /Z is nary longer thing I will automatically put successful a LAN migration bid conscionable because restartability sounds desirable. On a unchangeable section web I would commencement without it and adhd it only erstwhile I really request its semantics.
/MT is useful, but it helps a peculiar benignant of problem
Robocopy’s /MT:n action runs copies utilizing aggregate threads. It supports values from 1 done 128, pinch 8 threads arsenic the default if /MT is supplied without a number. Microsoft’s ain migration guidance besides points retired that much threads do not automatically construe into a faster migration and recommends measuring thread counts against the existent workload.
This made much consciousness erstwhile I stopped reasoning of /MT:4 arsenic “make 1 record 4 times faster.”
Imagine a euphony postulation pinch thousands of files of questionable provenance (I ripped them, conscionable kidding). There is activity associated pinch opening a file, creating the destination file, reference and penning its contents, dealing pinch metadata, and closing it again. A single-threaded transcript has periods wherever the web aliases retention tin beryllium waiting while 1 of those operations completes. Having respective files successful advancement astatine erstwhile gives Robocopy opportunities to overlap that work.
For this peculiar collection, 4 threads turned retired to beryllium a bully fit. Sixteen wasn’t evidently helping more, and 1 thread wasn’t an improvement. I would defy turning /MT into a magic worth that belongs successful each bid line, because a directory containing 50,000 photographs presents a different workload from 4 900 GB disk images.
There is besides a logging costs worthy remembering. Microsoft recommends redirecting Robocopy output to a log erstwhile utilizing multithreaded copies, and its migration guidance uses switches specified arsenic /NP, /NFL, and /NDL erstwhile the nonsubjective is throughput alternatively than watching each filename scroll by.
For a migration I americium not actively watching, I would astir apt usage thing like:
robocopy "\\server\share" "\\UNAS-Pro-8\share" /E /MT:4 /R:2 /W:2 /COPY:DATX /DCOPY:DATX /XJ /NP /NFL /NDL /LOG:"%USERPROFILE%\Desktop\nas-migration.log"Then came the ample files
Later I started copying immoderate files that were hundreds of gigabytes each. Microsoft describes /J arsenic unbuffered I/O and recommends it for ample files, truthful it seemed for illustration the evident action to try.
With /J enabled, however, NAS-to-NAS transportation slowed dramatically. The useful point astir having a Windows instrumentality successful the mediate is that I could trial each half of the travel separately. I took 1 of the nonstop aforesaid ample files and copied it straight from the Synology to my section machine. That ran astatine astir 250 MB/sec, truthful the Synology was perfectly tin of reference the record astatine precocious speed.
I past removed /J from the nonstop Synology-to-UNAS Robocopy command:
robocopy "\\server\share" "\\UNAS-Pro-8\share" "huge-file.ext" /R:0 /W:0 /COPY:DATX /NPand the velocity came back.
I don’t deliberation the useful conclusion is that /J is bad. Microsoft recommends it for large-file copies for a reason, and it is wholly imaginable that it is precisely what you want erstwhile copying from section disk to section disk aliases successful different web configuration. What mattered present was that Windows was simultaneously reference from 1 SMB server and penning to different SMB server, and connected this peculiar way buffered I/O performed overmuch better.
That is simply a bully reminder that command-line switches picture behavior, not guaranteed capacity improvements. /J changes the I/O model. /MT changes concurrency. /Z adds restartability. Whether those changes amended a migration depends connected the remainder of the system.
The Synology was faster than I gave it in installments for
At respective points I blamed the aging Synology. It is an aged instrumentality pinch spinning disks, truthful it was easy to presume that a fewer 100 megabits per 2nd was simply each it had left. Then I remembered that the Synology has 4 1 GbE interfaces and that SMB 3 supports Multichannel. I americium still amazed this worked truthful well.
SMB Multichannel allows an SMB convention to usage aggregate web paths simultaneously. Microsoft documents this specifically arsenic a measurement to aggregate disposable web bandwidth, and Synology supports SMB3 Multichannel for the aforesaid reason.
Windows makes the progressive channels easy to inspect:
Get-SmbMultichannelConnection -ServerName server | Format-Table ServerName,Selected,ClientIpAddress,ServerIpAddress,ClientLinkSpeed,ServerLinkSpeed,CurrentChannelsMy instrumentality reported:
ServerName Selected ClientIpAddress ServerIpAddress ClientLinkSpeed ServerLinkSpeed ---------- -------- --------------- --------------- --------------- --------------- server True 192.168.1.45 192.168.1.210 1000000000 1000000000 server True 192.168.1.45 192.168.1.198 1000000000 1000000000 server True 192.168.1.45 192.168.1.197 1000000000 1000000000 server True 192.168.1.45 192.168.1.26 1000000000 1000000000All 4 1 GbE interfaces connected the Synology were participating successful the SMB connection.
My Windows instrumentality presently has a 2.5 GbE adapter (10 gig coming soon), and during the accelerated transcript I was seeing astir 250 MB/sec arriving from the Synology. That abruptly made the behaviour of the strategy overmuch little mysterious. The Synology was not constricted to the throughput of 1 gigabit Ethernet relationship because SMB Multichannel was allowing Windows to usage the 4 disposable server-side paths, while the 2.5 GbE nexus connected the PC was becoming the smaller web pipe.
Synology’s archiving makes an important favoritism present betwixt SMB Multichannel and mean nexus aggregation. Multichannel tin summation SMB capacity for 1 customer by utilizing aggregate web connections, while accepted nexus aggregation is mostly astir aggregate throughput crossed aggregate clients and services.
Like I said, I person a 10 GbE adapter connected the measurement for the Windows machine, truthful location is different research disposable aft the migration. The Synology still only has 4 1 GbE interfaces, which gives it 4 Gb/sec of web links successful aggregate, but removing the existent 2.5 GbE customer bottleneck should show really overmuch farther the disks and the Synology itself tin go. For an older NAS that I had already mentally demoted to “the slow backup NAS,” it performed amazingly well.
I besides tried rsync
Yes, I know, what astir rsync? You are saying Windows arsenic a middleman is unnecessary. The Synology tin supply rsync, and UniFi Drive tin propulsion from an rsync server utilizing daemon mode. Ubiquiti documents the rsync way nether Drive’s Backup Tasks and requires daemon mode for this type of source.
I tried a abstracted movie stock pinch rsync while the different experiments were going on. It worked, and I saw astir 67 MB/sec. It besides gave maine a destination layout pinch immoderate further directory nesting that I would request to cleanable up afterward.
That is not an statement that rsync is slow successful general, nor that its directory behaviour cannot beryllium configured correctly. It is conscionable what happened successful this peculiar Synology-to-UNAS test. Once the Robocopy way was reaching astir 187 MB/sec and preserving precisely the UNC stock layout I wanted, location wasn’t overmuch inducement for maine to make rsync the superior migration mechanism.
The somewhat amusing consequence was that the apparently indirect path:
Synology -> SMB -> Windows -> SMB -> UNASwas considerably faster successful my situation than asking the 2 NAS devices to transportation the trial stock straight pinch the rsync implementation exposed by UniFi Drive. My conjecture is because rsync wasn't utilizing the 4 1gig connections linked. Let maine cognize what you deliberation successful the comments.
The Robocopy bid I ended up with
For the normal shares containing tons of files, this is the type I would commencement pinch now:
robocopy "\\server\share" "\\UNAS-Pro-8\share" /E /MT:4 /R:2 /W:2 /COPY:DATX /DCOPY:DATX /XJ /NP /NFL /NDL /LOG:"%USERPROFILE%\Desktop\nas-migration.log"The switches person reasonably circumstantial jobs:
/E Copy subdirectories, including quiet ones /MT:4 Allow 4 file-copy threads /R:2 Retry a grounded transcript twice /W:2 Wait 2 seconds betwixt retries /COPY:DATX Copy data, attributes and timestamps, but skip ADS /DCOPY:DATX Apply the corresponding directory transcript flags /XJ Exclude junction points /NP Don't people percent progress /NFL Don't log each filename /NDL Don't log each directory /LOG Write the useful output to a fileI deliberately do not person /Z successful there. I besides would not automatically adhd /J; for a workload dominated by very ample files I would trial the aforesaid transportation some pinch and without it earlier committing to a multi-terabyte run.
The /MT worth is likewise empirical. Four worked highly good for this Synology and this operation of files, but I would effort 1, 4, 8, aliases different sensible number against a typical portion of the existent information alternatively than assuming that the largest disposable thread count is best.
Checking the result
For the files wherever I attraction capable to beryllium that the destination contains precisely the aforesaid bytes arsenic the source, PowerShell’s Get-FileHash is simply a convenient last check:
Get-FileHash "\\server\share\huge-file.ext" -Algorithm SHA256 Get-FileHash "\\UNAS-Pro-8\share\huge-file.ext" -Algorithm SHA256Get-FileHash uses SHA-256 by default, and if the SHA-256 values lucifer past the 2 inputs produced the aforesaid digest. For tremendous files this requires reference the full record again astatine some ends, truthful I americium improbable to hash each opus successful a euphony collection, but it is an easy measurement to verify the peculiarly valuable multi-hundred-gigabyte files aft a migration.
A fewer things I’d cheque earlier blaming the NAS
What made this migration absorbing was that the symptoms could person supported respective plausible explanations. The UNAS has a caller RAID array, the Synology is old, Windows is acting arsenic an SMB customer successful some directions, the files came from years of different applications, and Robocopy has capable switches to make almost immoderate bid statement look authoritative.
When a record failed, I copied it Synology-to-local and past local-to-UNAS, which exposed the destination-side ADS problem. When ample files were slow, I copied the aforesaid record Synology-to-local, which proved the aged NAS could still present astir 250 MB/sec. When the web abruptly became overmuch faster, Get-SmbMultichannelConnection showed that each 4 Synology Ethernet interfaces were participating. When /J looked slow, removing conscionable that behaviour restored the throughput I was expecting.
The last capacity was not the consequence of uncovering a concealed “fast Robocopy” bid from a forum. It came from reasoning astir which features I really wanted for this migration and removing a fewer that were useful successful different circumstances but costly successful mine.
That is astir apt the portion I will want to retrieve the adjacent clip I do this. /Z, /J, and /MT are not levels connected a capacity slider. They alteration restartability, buffering, and concurrency. Alternate Data Streams are existent information moreover erstwhile Explorer usually hides them. SMB Multichannel tin make an aged NAS pinch respective gigabit interfaces overmuch much tin than 1 mightiness presume from looking astatine immoderate azygous Ethernet port.
Robocopy ended up being the fastest point I tried. As pinch each advice, this worked for me. Ideally you'll gind much worth successful the comments arsenic Hacker News folks and Windows experts will driblet successful pinch amended devices and strategies. Just remember, there's much than 1 measurement to saturate a web and I wholly saturated this one, truthful I'm beautiful happy pinch the consequence of my migration.
About Scott
Scott Hanselman is simply a erstwhile professor, erstwhile Chief Architect successful finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is simply a grounded stand-up comic, a cornrower, and a book author.
![]()
About Newsletter
Hosting By
English (US) ·
Indonesian (ID) ·