How to move applications from one volume to another on Synology
Today I want show you a solution to move Synology applications from one volume to another. In my case, I will move it from Volume 1 to Volume 2.
Preparation
First of all you need to stop all the applications manually (open the application manager in the DSM). After this connect to your synology over SSH (enable it if not done yet).
Migration
Now we move all the applications from Volume 1 to the new Volume (in my case Volume 2):
mv /volume1/@appstore/* /volume2/@appstore/
Then we need to find out which applications have a link to the old volume:
find /var/packages/ -type l -ls | grep volume1
The output, depending on which applications you have installed, should look like this:
4480 0 lrwxrwxrwx 1 root root 34 Nov 4 18:39 /var/packages/DownloadStation/target -> /volume1/@appstore/DownloadStation
18333 0 lrwxrwxrwx 1 root root 28 Nov 4 18:39 /var/packages/VPNCenter/target -> /volume1/@appstore/VPNCenter
23299 0 lrwxrwxrwx 1 root root 28 Nov 4 18:40 /var/packages/DNSServer/target -> /volume1/@appstore/DNSServer
7021 0 lrwxrwxrwx 1 root root 31 Nov 4 18:39 /var/packages/VideoStation/target -> /volume1/@appstore/VideoStation
18325 0 lrwxrwxrwx 1 root root 30 Nov 4 18:40 /var/packages/MediaServer/target -> /volume1/@appstore/MediaServer
23973 0 lrwxrwxrwx 1 root root 31 Nov 4 18:41 /var/packages/CloudStation/target -> /volume1/@appstore/CloudStation
19596 0 lrwxrwxrwx 1 root root 28 Nov 4 18:41 /var/packages/AntiVirus/target -> /volume1/@appstore/AntiVirus
23175 0 lrwxrwxrwx 1 root root 34 Nov 4 18:38 /var/packages/StorageAnalyzer/target -> /volume1/@appstore/StorageAnalyzer
For each application you need to create a new simbolic link replacing the old one:
ln -sfn /volume2/@appstore/DownloadStation /var/packages/DownloadStation/target
ln -sfn /volume2/@appstore/VPNCenter /var/packages/VPNCenter/target
ln -sfn /volume2/@appstore/DNSServer /var/packages/DNSServer/target
ln -sfn /volume2/@appstore/VideoStation /var/packages/VideoStation/target
ln -sfn /volume2/@appstore/MediaServer /var/packages/MediaServer/target
ln -sfn /volume2/@appstore/CloudStation /var/packages/CloudStation/target
ln -sfn /volume2/@appstore/AntiVirus /var/packages/AntiVirus/target
ln -sfn /volume2/@appstore/StorageAnalyzer /var/packages/StorageAnalyzer/target
To be sure check that now the symbolic links are pointing to the new volume:
find /var/packages/ -type l -ls | grep volume2
The result:4480 0 lrwxrwxrwx 1 root root 34 Nov 5 13:59 /var/packages/DownloadStation/target -> /volume2/@appstore/DownloadStation
6171 0 lrwxrwxrwx 1 root root 28 Nov 5 14:01 /var/packages/VPNCenter/target -> /volume2/@appstore/VPNCenter
17675 0 lrwxrwxrwx 1 root root 28 Nov 5 14:01 /var/packages/DNSServer/target -> /volume2/@appstore/DNSServer
7021 0 lrwxrwxrwx 1 root root 31 Nov 5 14:01 /var/packages/VideoStation/target -> /volume2/@appstore/VideoStation
17850 0 lrwxrwxrwx 1 root root 30 Nov 5 14:01 /var/packages/MediaServer/target -> /volume2/@appstore/MediaServer
17857 0 lrwxrwxrwx 1 root root 31 Nov 5 14:01 /var/packages/CloudStation/target -> /volume2/@appstore/CloudStation
17986 0 lrwxrwxrwx 1 root root 28 Nov 5 14:01 /var/packages/AntiVirus/target -> /volume2/@appstore/AntiVirus
18102 0 lrwxrwxrwx 1 root root 34 Nov 5 14:01 /var/packages/StorageAnalyzer/target -> /volume2/@appstore/StorageAnalyzer
Conclusion
The migration is done and you can start the applications again. They should work as normal 😉
Sanderl ( )
Hi Luca, this seems a solution for my problem. I want to get rid of Volume1 and therefore I need to move everything Volume2. Goal is to create a new Btrfs Volume1 instead of an EXT4 Volume1.
I have migrated (move via the GUI) all shared folders to Volume2.
Then I think I can use your above code to temporarily move all packages (and symbolic links? don’t know what that exaclty is 🙂 to Volume2.
Then delete EXT4 Volume1 and create Btrfs Volume1 back…
And then I think I can use the first part to move all packages back from Volume2 to Volume1 with the firts part of you code before the synbolic links parts.
But then I am in doubt. My logic says then you just need to “remove” the symbolic links (still don’t know exactly what they are) and everything should work then…
The thing is… if something goes wrong. I am screwed so I need to be absolutely sure this works…
Can you help out here?
Thanks in advance!
Luca ( )
Hi Sanderl, the symbolic links are needed to tell the package (that are installed under /var/packages) where the config and data are saved (in this case we change it from /volume1 to /volume2). So, don’t delete they otherwise the package can not start. I have already done these procedure a few times (also to convert from ext4 to btrfs) and it worked perfectly! Btrfs also increased the read/write speed 🙂 Regards, Luca
Sanderl ( )
Hi Luca,
thank you for your reply. I understand where the symbolic links are for now. My question is about the updating of them after migrating back from volume 2 to volume 1 (Btrfs). Do I need to run your “script” to go back to volume 1 (place the symbolic links back pointing to volume 1, or is there some command to “remove” the link to volume 2? And thus it is automatically relinked to volume 1?
Luca ( )
Hi Sanderl, to go back to volume 1 you need to do the same procedure, only replace the volume number. The links are automatically overwritten and relinked to the volume 1. Regards, Luca
Sanderl ( )
Hi Luca, tried it for 1 application (Sonar) and is all looks good. Package center says it is installed on volume2 and symbolic link is ok. but package wont start anymore. Any idea?
Luca ( )
If you type “find /var/packages/ -type l -ls | grep volume2” is the symbolic link listed? And if you type “ls /volume2/@appstore/” is the Sonar app also listed? Have you tried to restart the synology? Do you get an error message? Regards Luca
Sanderl ( )
Hi, first qustion: yes. Second question: yes. No error, just not starting. I removed the app… Maybe some internal mentioning of volume1. I did not restart synology. I tried to install a test app on volume 1, Synology Chat. Did the same, it is now moved to volume 2 and running. but no icons that I can start the app with anymore…
Sanderl ( )
Also no icons to start application after complete reboot… Do I mis anything? I am so happy didn’t try all at once!
Sanderl ( )
I I remove the package from package center it remves it nicely from volume2 including the directory which was moved before.
Luca ( )
I saw the same behaviour… I just logged off and logged in again on DSM and the icons were visible again.
Sanderl ( )
But I have completely rebooted the NAS and they were not visible…?
Luca ( )
Strange… I can not reproduce it on my Synology… what Synology do you have? I have testet it on a DS916+ with DSM 6.0.2-8451 Update 4. If you try to reinstall the app manually does it mantain the config?
Sanderl ( )
DS1815+ with DSM 6.0.2-8451 Update 4. I do not precisely understand what you mean with “If you try to reinstall the app manually does it mantain the config?”
Luca ( )
As workaround you can try to uninstall and install the app again… hopefully it don’t loose the app’s settings.
Harro Verton ( )
If the icons in the main menu are missing, chances are that AppArmor is blocking access to the new location of the app. To test this, stop it using “/usr/syno/etc/rc.sysv/apparmor.sh stop”, then logout and login again. If you now have the icons back, you need to modify the AppArmor policies.
Mark ( )
Thanks for posting this Luca – really helped me out of a bind! I only had to make one small tweak, and that was because my new /volume2 did not already have a directory @appstore, so the first command looked like:
mv /volume1/@appstore /volume2/
All in all it’s a very tedious, time-consuming and (unusually for Synology) un-user-friendly process to migrate from one volume to another.
Sebastian Ott ( )
I wrote a small script for moving packages. If someone is interested, I put it on github: https://gist.github.com/nobodypb/fc3e70b535bcd95b5de7659d6fbda434
Luca ( )
Thank you Sebastian… next time I will try it 😉
Frank Elcheroth ( )
Hy. This descriptions sound great. But I have an access problem, while trying to copy the data from one volume to another. Permission denied is the answer. However, I’ve logged in with admin account into synonolgy and have all rights: What can I do furthermore. chmod 777 does not work as well.
Luca ( )
Hi Frank, the admin account has not enough permissions to copy the data. Try to change to the root user with “sudo -i” and enter your password again. After this you should see “root@synology:~#” and not “admin@synology:~#” in the command line. Regards, Luca
Frank Elcheroth ( )
Hi Luca. Thanks for your reply. Indeed I tried as you indicated it with sudo -i. And indeed it worked. At migrated all my apps from vol 2 to vol1. Thank you very much for the answer
Mark ( )
Very much appreciated this article after one of my 2 volumes crashed – unfortunately I didn’t have a RAID setup so had to copy all data from one to another disk, and then the changing of these links saved me a whole lot of pain with the apps.
Luca ( )
Hi Mark, glad to hear this and thanks for the feedback 🙂
Aliaksei ( )
Worked perfectly – many thanks!
Jarkko ( )
Luca, you are the saviour. Synology could not provide me the instructions how to move apps from one volume to another, but your guide was just perfect. I have one more issue, the Drive Server is still somehow in old volume so i can;t remove the old volume 1 even there are no links or anything visible. Do you have any idea what could be hanging still and how to remove the last obstacle? thanks heaps.
Luca ( )
Hi Jarkko, thanks for the feedback. Strange, are you sure that you stopped the Drive application before moving it? Do you have an error message?
Stefano Dall’Olio ( )
Hello, I made this simple bash script to speedup the process…
simply write those commands in a file and then:
chmod +x filename
./filename
— script —
#!/bin/bash
# implement line command parameters here
VOLSRC=2
VOLDST=1
# implement some controls here; source exists and has apps, dest exists, etc
echo -e “\n– Move Apps from ‘/volume${VOLSRC}’ to ‘/volume${VOLDST}’ –”
# mv /volume${VOLSRC}/\@appstore /volume${VOLDST}/
echo -e “\n– App Symlink Status –”
find /var/packages/ -type l -ls | grep volume${VOLSRC}
echo -e “\n”
for app in /volume${VOLDST}/\@appstore/*; do
app=$(basename ${app})
# ln -sfn /volume2/@appstore/VPNCenter /var/packages/VPNCenter/target
echo “==> ln -sfn /volume${VOLDST}/\@appstore/${app} /var/packages/${app}/target”
ln -sfn /volume${VOLDST}/\@appstore/${app} /var/packages/${app}/target
done
echo -e “\n– App Symlink Result –”
find /var/packages/ -type l -ls | grep volume${VOLDST}
Luca ( )
Hi Stefano, thank you for sharing it!
Romain ( )
Hi,
Just attempted this scenario, GREAT !
But afterwards, some apps still refused to execute.
Found-out that there are some additional simlinks in /usr/local/ :
find /usr/local/ -type l -ls | grep volume
and update simlink with the ln -sfn command.
Enjoy !
Ben J ( )
Some Apps I’ve found have a setting.conf file that needs to be manually altered.
It can be found here in the volume @appstore folder (where X = your volume number )
/volumeX/\@appstore/*/etc/setting.conf
Modify it so it is pointing to the correct Volume otherwise the app wont start.
{“conf_repo_volume_path”:”/volumeX”}
Ilias K ( )
This was a VERY helpful post. I strugled for a few days with this. In DSM 7 there are multiple folders to move/copy between volumes, it’s not just @appstore. There is also @appdata, @apphome, @appconf and @apptemp. The find/grep above as you’ve written it will show them.
Also, if you hard drive crashes and turns to read-only, you cannot mv but you need to copy, recurse and preserve attributes (so use “cp -a /volume1/@appstore/* /volume2/@appstore/”, “cp -a /volume1/@appdata/* /volume2/@appdata/”, etc). Also for several packages, there are symbolic links within the @appstore package folder, so make sure you update those as well (i.e. @appstore/SurveillanceStation/@surveillance -> /volume1/@surveillance, docker, can’t remember what else).