/synology-stuff

my tools around my synology NAS

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

synology-stuff

my tools around my synology NAS

Migration from one Synology to another Synology

As I wanted to migrate from a DS215j (no encryption) to a DS720+ (with encryption), I made some experiences during which I wrote my migration support python code. My be it is useful to you also.

Problem with migration by backup was that on my target system I switched on encryption on the internal volume. What I did not know in advance was the fact that on the encrypted file system (ecryptfs) the length of filenames is restricted to 143. This alone would not have been too bad because I did not have many files with filenames longer than 143. But the HyperBackup Tool just exits when it encounters such an error while restoring. So after having restored 2.2TB it just finished. Then I learned about the problem, looked in the HyperBackup log what the compromising files where, renamed these files to shorter names on the source system, started a new incremental backup, then restarted the restore. To my astonishment the restore did not begin at 2.2TB but at 0. So it took all the time again it already had spent to restore 2.2TB, which were approx. 10h. All would have been fine if it were that. But then HyperBackup complained about more files with more than 143 name length. So I wrote a python script to identify all files on my source NAS with more than 143 name length. Ran it and fixed the length by renaming the files. New backup. New restore. But alas, the story did not end, HyperBackup still found files with names too long. Every german umlaut in UTF-8 occupies 2 Bytes, so I rewrote my python script to measure the real length. In the meanwhile also the indexer ran on my source system, and added a suffix like '@somethin' to the filenames in '@eaDir'. So the length of these index files of my renamed files still exceeded the maximum name length of 143. Since this all takes much time to backup and restore and wait until a new error is reported by HyperBackup I decided to try rsync because then my users could continue to work and I could do incremental restore, a feature missing in HyperBackup. To my great suprise the rsync implementation not only is really slow, I got about 15MB/s, but also will not transfer the ACLs. The option to transfer the ACLs ist not present in the synology rsync implementation. The transfer speed did not bother me too much because when doing incremental migration, this could take days and my users still can work on the old NAS until migration is completed. Then only a short downtime is needed to switch to the new NAS. But what to do with the ACLs? I found a synology tool 'synoacltool' to get and set ACLs. So on the synology NAS with 'find . -exec ...' I generated a complete list, processed this list with my python script on my linux machine generating an sh-script for the synology to set the ACLs and another script to check whether this operation was complete and correct.

preparation on the source system

check length of filenames

rename these files

start rsync to target system

omit @eaDir

generate ACL-Listing

transfer ACL-Listing to your computer

generate scripts

transfer scripts to target system

when rsync is completed run ACL-script

run ACL-check

transfer ACL-check result to computer

compare ACL-check result with original ACL-Listing

setup ssh on synology