How can I back up and restore shared file links in Synology Drive and File Station?
How can I back up and restore shared file links in Synology Drive and File Station?
Purpose
This article guides you through how to back up and restore shared file links created in Synology Drive and File Station for DSM 6.2.
Resolution
Back up and restore Synology Drive file sharing links
Use Hyper Backup to back up and restore the entire Synology Drive Server package. Refer to this article for details.
Back up File Station shared file links
On DSM 7.0 and above:
Use Hyper Backup to back up the File Station package. Refer to the Hyper Backup Quick Start Guide for details.
On DSM 6.2 and earlier:
- Sign in to DSM via SSH.1
- Type in the following commands if you want to use the admin home folder as the backup destination. Replace the volume number and the folder path (the text in red) according to your environment.
- cp /usr/syno/etc/private/session/sharing.db /volume1/homes/admin
- cp /usr/syno/etc/private/session/sharing.db-shm /volume1/homes/admin
- cp /usr/syno/etc/private/session/sharing.db-wal /volume1/homes/admin
- Use Hyper Backup or other methods to back up the folder that contains the file sharing databases.2
Restore File Station shared file links
On DSM 7.0 and above:
If you used Hyper Backup to back up the File Station package, you can use Hyper Backup for restoration. Refer to the Hyper Backup Quick Start Guide for details.
On DSM 6.2 and earlier:
- Sign in to DSM via SSH.1
- Type in the following commands if you want to restore the file sharing databases from the admin home folder. Replace the volume number and the folder path (the text in red) according to your environment.
- cp /volume1/homes/admin/sharing.db /usr/syno/etc/private/session/
- cp /volume1/homes/admin/sharing.db-shm /usr/syno/etc/private/session/
- cp /volume1/homes/admin/sharing.db-wal /usr/syno/etc/private/session/
- Type in the following command to make sure the permissions of the three shared file link databases
sharing.db
,sharing.db-shm
, andsharing.db-wal
are correct.- ll /usr/syno/etc/private/session/ | grep sharing
- The command should return results as below (the text in green). The correct Unix permissions are
-rw-rw----
, user and group are bothsystem
.- -rw-rw---- 1 system system 29696 Dec 2 16:33 sharing.db
- -rw-rw---- 1 system system 32768 Dec 2 16:33 sharing.db-shm
- -rw-rw---- 1 system system 13656 Dec 2 16:16 sharing.db-wal
- If the permissions of those databases are incorrect, type in the following commands to correct the permissions:
- cd /usr/syno/etc/private/session
- chmod 660 sharing.db sharing.db-shm sharing.db-wal
- chown system:system sharing.db sharing.db-shm sharing.db-wal
On DSM 7.0 and above, from DSM 6 backups:
If you have backed up shard file link databases for DSM 6.2 or earlier and need to restore them on DSM 7.0 and above, follow these steps:
- Sign in to DSM via SSH.1
- Type in the following commands if you want to restore the file sharing databases from the admin home folder. Replace the volume number and the folder path (the text in red) according to your environment.
- cp /volume1/homes/admin/sharing.db /usr/syno/etc/private/session/sharing/
- cp /volume1/homes/admin/sharing.db-shm /usr/syno/etc/private/session/sharing/
- cp /volume1/homes/admin/sharing.db-wal /usr/syno/etc/private/session/sharing/
- Type in the following command to make sure the permissions of the three shared file link databases
sharing.db
,sharing.db-shm
, andsharing.db-wal
are correct.- ll /usr/syno/etc/private/session/sharing/ | grep sharing
- The command should return results as below (the text in green). The correct Unix permissions are
-rw-rw----
, user and group are bothsystem
.- -rw-rw---- 1 system system 29696 Dec 2 16:33 sharing.db
- -rw-rw---- 1 system system 32768 Dec 2 16:33 sharing.db-shm
- -rw-rw---- 1 system system 13656 Dec 2 16:16 sharing.db-wal
- If the permissions of those databases are incorrect, type in the following commands to correct the permissions:
- cd /usr/syno/etc/private/session/sharing/
- chmod 660 sharing.db sharing.db-shm sharing.db-wal
- chown system:system sharing.db sharing.db-shm sharing.db-wal
Notes:
- Refer to this article to learn how to sign in with root permission via SSH/Telnet.
- Other methods include using other backup applications or making a copy of the database files to another folder.
- Restoring shared link databases to another NAS might cause the links to become invalid because the sharing file/folder's paths changed on the destination server. Before restoring, make sure the file/folder structure, network configurations, user configurations are consistent with the source server.
- The sharing record of DSM local account might become invalid after restoration even if it is the same account name. We recommend also restoring the source server's user/group configurations to the destination server. Refer to this article for details.
- Gofile.me shared file links generated through QuickConnect can only be restored to the original NAS. They will become invalid if restored to other NAS or even if the original NAS was reset to its factory settings.