When I set up my own Synology DS1815+, I created a large hard disk volume for most of my storage requirements. For the heck of it I had also created a RAID1 volume of a pair of 30 GB solid-state drives that I had lying around. I was curious to see whether installing applications to the solid-state drive would improve responsiveness or speed up the boot time. As it turns out, I’m not a demanding enough user to really notice a difference.
As my larger volume started filling up, the real estate taken up by those two small 30 GB solid-state drives became an obstacle. The problem was, I had already installed all of the applications to that volume. So I sought a way to move the applications without having to reinstall them, since I was afraid reinstalling AudioStation, PhotoStation or VideoStation might prompt a whole-volume index which I’m not eager to do – it takes ages.
As it turns out, this is relatively easy for most applications – even third-party ones. Apps like Snapshot Replication, CrashPlan and DownloadStation had to be uninstalled and reinstalled manually, but for the majority of apps this should work. Strictly speaking, DownloadStation didn’t need to be uninstalled manually but there were some remaining temp files in /volume3/@download that I didn’t want so I opted to just reinstall it manually.
I would not recommend this unless you know what you’re doing.
Moving an Application Between Volumes in DSM 5.x or DSM 6.x
Before doing the following, make sure all of the applications that are about to be moved have been stopped. You can do this by opening the Package Center, visiting each application entry under Installed and then clicking Action->Stop. I found it was easier to use my iPhone to login to the DSM console where there’s a handy “Stop” button for each application without having to tediously visit each entry.
You may also opt for the command-line method of stopping these services, since you’ll be digging around in there anyway.
sudo /var/packages/[app_name]/scripts/start-stop-status stop
So the process comes down to three basic commands. In the example below, it assumes that the current installation volume is volume1, and the desired one is volume3:
# Move the app files from the old volume to the desired one. sudo mv /volume1/@appstore/[app_name] /volume3/@appstore/ # Delete the obsolete Symlink pointing at the old app path sudo rm -fv /var/packages/[app_name]/target # Create a new Sim link pointing at the new, correct app path. sudo ln -s /volume3/@appstore/[app_name] /var/packages/[app_name]/target
Now you can either reboot or simply visit the Package Center and manually start the apps again. Each app entry should now show the correct new installation volume.
bogd13 says
Thank you! This really helped me – I wanted to retire my first, smaller volume, and I didn’t want to have to reconfigure all my packages (I did try to uninstall/reinstall them on the other volume, but some actually need to be reconfigured from scratch when doing that – CloudStation ShareSync, for example!).
One small note – you may need to escape the ‘@’ in the file names. In my case, the commands I had to use were:
sudo mv /volume1/\@appstore/[app_name] /volume2/\@appstore/
sudo rm -fv /var/packages/[app_name]/target
sudo ln -s /volume2/\@appstore/[app_name] /var/packages/[app_name]/target
Ogy says
source=”volume1″
target=”volume2″
echo “stopping apps/n”
for entry in `ls /${source}/@appconf/`; do
/var/packages/$entry/scripts/start-stop-status stop
done
echo “Moving appstore/n”
for entry in `ls /${source}/@appstore/`; do
mv /$source/@appstore/$entry /$target/@appstore/
rm -vf /var/packages/$entry/target
ln -s /$target/@appstore/$entry /var/packages/$entry/target
done
echo “Moving etc/n”
for entry in `ls /${source}/@appconf/`; do
mv /$source/@appconf/$entry /$target/@appconf/
rm -vf /var/packages/$entry/etc
ln -s /$target/@appconf/$entry /var/packages/$entry/etc
done
echo “Moving home/n”
for entry in `ls /${source}/@apphome/`; do
mv /$source/@apphome/$entry /$target/@apphome/
rm -vf /var/packages/$entry/home
ln -s /$target/@apphome/$entry /var/packages/$entry/home
done
echo “Moving temp/n”
for entry in `ls /${source}/@apptemp/`; do
mv /$source/@apptemp/$entry /$target/@apptemp/
rm -vf /var/packages/$entry/tmp
ln -s /$target/@apptemp/$entry /var/packages/$entry/tmp
done
echo “Moving data/n”
for entry in `ls /${source}/@appdata/`; do
mv /$source/@appdata/$entry /$target/@appdata/
rm -vf /var/packages/$entry/var
ln -s /$target/@appdata/$entry /var/packages/$entry/var
done
echo “starting apps/n”
for entry in `ls /${source}/@appconf/`; do
/var/packages/$entry/scripts/start-stop-status start
done
Ruud says
Thanks for all your help Andrew and bogd13, worked for me with and without extra escape.
Also I choose to run “sudo mv /volume1/@appstore/ /volume2/@appstore/”, so not mentioning alle package names.
By mistake I had not changed Symlink pointing yet. But I looked in Package Center where “repair” and “repair all” was seen and before I thought all through my mouse point was on the “repair all” and choose it. It took some time but all had been repaired without any problems; if any should not be repaired you can remove package and reinstall but it will be for only some and is not time consuming any more
Ben Batschelet says
I also had to update a symbolic link under `/usr/local` to point to the new volume:
“`
sudo rm -fv /usr/local/[app_name]
sudo ln -s /volume3/\@appstore/[app_name] /usr/local/[app_name]
“`
Rob Tyler says
An excellent article, and worked first time – thank you!
Laszlo Boviz says
Thanks for sharing this. Saved me hours.
Fredrik Erlandsson says
This is what I did to automate the ln process..
SAVEIFS=$IFS
IFS=$(echo -en “\n\b”)
cd /var/packages
for F in *; do ls -l ${F}/target; sudo ln -sf /volume2/\@appstore/${F} /var/packages/${F}/target; ls -l ${F}/target; done
cd /usr/local
for F in *; do if [ -h ${F} ]; then ls -l ${F}; sudo ln -sf /volume2/\@appstore/${F} ${F}; ls -l ${F}; fi; done
IFS=$SAVEIFS
Fredrik Erlandsson says
Don’t forget to move the @img_bkp_cache too and change `/usr/syno/etc/synobackup.conf`
i.e.
vi /usr/syno/etc/synobackup.conf -c ‘:%s/volume1/volume2/g’ -c ‘:wq’
Acto says
Thanks, works great. Be aware that at least for Surveillance station there are different paths.
It has an @surveillance directory in the root of volume1. Best to look at the symbolic links in the package directory.
Sebastian Ott says
I wrote a small script for moving packages. If someone is interested, I put it on github: https://gist.github.com/nobodypb/fc3e70b535bcd95b5de7659d6fbda434
blitzdesigner says
@Sebastian Ott
Thank you for your script, worked good so far.
But I am not sure what to do with the message at the end:
###########
If you want to remove /volume1 you should also move the following:
System service symlink /var/services/download to /volume1/@download
System service symlink /var/services/pgsql to /volume1/@database/pgsql
System service symlink /var/services/printer to /volume1/@spool
System service symlink /var/services/tmp to /volume1/@tmp
########
I was moving from /volume1 to /volume2, so shouldnt be there /Volume2/ in the end?
and, how do I move those symlinks?
thank you for a little hint :-)
PJThys says
Did you get an answer on your question? I need to remove the volume and recreate it as part of a switch from raid 1 to 2 basic volumes. All went smooth, but I can’t remove volume 1 from storage manager.
than0s says
My 2cents here:
As Drive was not starting up, I had also to edit /var/packages/SynologyDrive/etc/db-path.conf in order to have db-vol=/volumeX.
Max says
So does this still work on the newest DSM, 6.2? Trying to move surveillance station to Volume 1, already moved the shared folder in system settings, but not yet the package.
Jay Bee says
Thank you very much for this. It saved me a lot of time.
Richard says
Looks like its worked for me. (will find out after a restart)
Moved even my email server.
You superstar.
John Walshaw says
Very helpful method and thank you.
Jefferson says
Thank you so much! This helped much. I wrote a bash script that should make the process faster and easier. Here’s the link https://github.com/JeffersonDing/SynologyMerge
Thanks!
Bob says
Will this also work to move VMM from e.g. volume1 to volume2? I like to move my virtual machine manager and the vm’s to an SSD on volume2.
How do I proceed?
TIA
Baelor says
Hi Andrew! Just wanted to say thank you very much for this description! It still mostly works 7 years later while using DSM7.2.1.
The scripts for starting or stopping apps are there but did not work, I had no reaction when calling them with either start, stop or status. So in the end I resorted to stopping the apps manually in the Package Manager before doing the moving or killing them via their PID.
I used your description for migrating apps from volume1 to volume2, especially I migrated Synology Drive Server and it worked like a charm!
The only issue I had was with Node.js_v18 because Synology Drive Server depends on it and so had to be moved as well: It is a process that can seemingly not be stopped and it just restarted instantly after killing it. So in the end I resorted to executing your recipe with moving, removing the symlink and creating a new symlink for Node.js_v18 **without** stopping this process. It worked sort of, after a reboot the Package Manager threw a failure for this package and proposed a “Repair” –> it installed it anew and this time I could choose the correct volume.
–> Another reboot later and everything (Synology Drive Server and Node.js_v18) was running again on volume2. :)
Bogdan says
It works flawlessly on DSM 7.1 as well. Thank you very much!