Move a Synology Package from a volume to another

I wanted to replace the smallest disks of my NAS with bigger ones. Unfortunately, some packages where installed on those. To avoid uninstalling/reinstalling everything, I did wrote a shell script which does the job, as well as a Package for Synology to offer a web interface.

Click to Read More

Here the first version of my script:



if [[ $PACKAGE == "" ]]
	echo "Usage: mvpkg Target Package"
	echo "       Target must be like 'volumex' where x is a numeric."
	echo "       Package must be the name of a package."

if [[ $TARGET != volume[0-9]* ]]
	echo "Usage: mvpkg Target Package"
	echo "       Target must be like 'volumex' where x is a numeric."
	echo "       Package [$PACKAGE] must be the name of a package."

#Check the package and check the result: "enable" (is start), "disable" (is stop) or "does not exist"
output=$(/usr/syno/sbin/synoservicecfg --status "pkgctl-$PACKAGE" | grep Service)

if [[ $output == *"does not exist"* ]]
	echo "The service $PACKAGE can't be found."
	#find the current volume of the package and its link
	output=$( ls -la /var/packages/*/target | grep "/$PACKAGE/")
	link=$(echo $output | grep -oP "\/var/packages/.*/target")
	volume=$(echo $output | grep -oP "volume\d*")
	path=$(echo $output | grep -oP "\/volume.*")
	if [[ $link != "/var/packages/$PACKAGE/target"* ]]
		echo "The service $PACKAGE is not correctly installed."
	if [[ $volume != "volume"* ]]
		echo "The service $PACKAGE can't be located."

	if [[ $volume == $TARGET ]]
		echo "The service $PACKAGE is already on $TARGET."
	if [[ "$path" != "/$volume/@appstore/$PACKAGE" ]]
		echo "The service $PACKAGE does not have a standard location."
	#List Packages with dependency on this one
	#/usr/syno/sbin/synoservicecfg --reverse-dependency pkgctl-$PACKAGE
	#Stop the package and all its dependencies
	output=$(/usr/syno/sbin/synoservicecfg --hard-stop "pkgctl-$PACKAGE" | grep warn)
	if [[ $output != *"have been set"* ]]
		echo "The service $PACKAGE couldn't be stopped."
	if [ -d "/$TARGET/@appstore/$PACKAGE" ]; then
		mv "/$TARGET/@appstore/$PACKAGE" "/$TARGET/@appstore/$PACKAGE-$(date -d "today" +"%Y%m%d%H%M").log"

	#remove the link on the previous volume
	rm -f "$link"
	#move the package
	mv "$path" /$TARGET/@appstore
	#link with the  package on the new volume
	ln -s "/$TARGET/@appstore/$PACKAGE" "$link"
	#Replace link also in local 
	if [ -L "$local" ]; then
		rm -f "$local"
		ln -s "/$TARGET/@appstore/$PACKAGE" "$local"
	#update settings
	sed -i "s/$volume/$TARGET/" "/usr/syno/etc/packages/$PACKAGE/*" &>/dev/null
	if [[ $output != *"is enabled"* ]]
		echo "The service $PACKAGE didn't restart properly once moved from $volume to $TARGET."
		echo "The service $PACKAGE has been moved successfuly from $volume to $TARGET."

		#Restart packages depending on the one moved
		output=$(/usr/syno/sbin/synoservicecfg --reverse-dependency "pkgctl-$PACKAGE")

		output="$(echo $output | grep -Po "pkgctl-([^\]]*)")"
		for string in $output
			/usr/syno/sbin/synoservicecfg --start "$string"

	#Restart the package and all its dependencies
	output=$(/usr/syno/sbin/synoservicecfg --hard-start "pkgctl-$PACKAGE" | grep Service)
	#Check if the package has been correctly restarted
	output=$(/usr/syno/sbin/synoservicecfg --is-enabled "pkgctl-$PACKAGE")

It is inspired from this post.

I did use it to move: AudioStation, CloudStation, DNSServer, NoteStation, PHP5.6, PHP7.0.

During the move, the package could temporary appear in the Package Center as needing to be repaired:

Repair Package

Repair Package444

Simply wait until the operation is completed and click next on "Refresh" in Package Center. Also, check that no other service was stopped but not restarted !! Restarting other services with dependency is not (yet) managed by the script.

WARNING: Moving some packages resulted in troubles (Packages never able to restart). Ex.: Apache Http Server 2.2 and 2.4, the Node.js, Unofficial Java Installer, WordPress. These packages did not restart properly after being moved. I still have to investigate why, but they displayed the error "failed to run the package service" for ever (even after restarting the NAS). Something I known is that there are also Symlinks onto packages in /usr/local/. My script takes those into account. But there are possibly other such dependencies somewhere else ?! Most package could fortunately be returned in their orignal state very easily by moving them back to their original volume.

Important notice

MariaDB. Before moving it, open it via the DSM main menu and change the volume where the DB files are stored.

If you wonder which package is on which volume, the easiest is to run this command in a shell: ls -la /var/packages/*/target


WordPress. After moving, it was stuck in the "repair state". I simply backuped its folder (/volumex/web/wordpress => /volumex/web/wordpress.bkp), clicked on Repair, reconfigured it to use a new DB, stopped it once fully reinstalled, deleted its new folder and replaced it with the backup (/volumex/web/wordpress.bkp => /volumex/web/wordpress) before restarting wordpress and deleting the new DB.

Node.jsFileBot-Node and the Unofficial Java Installer. I simply clicked on Repair to fix them.

Plex Media Server. during y first attempts, it didn't restart. I did simply install manually the latest version and the "update" fixed the problem without loosing any setting/library/etc... With the latest version of my script, the move succeeded.

Can't restart. Look into Package's installation path, for config files possibly still pointing at the old volume. Use for this purpose a command like:  find -L /var/packages/<package_name>/ -type f -print0 | xargs -I {} -0 grep -l "volumex" "{}"

If you find such config files, possibly update them by replacing the old volume (volumex) with the new volume (volumez) using a command like: sed -i "s/volumex/volumez/" <config_file_path>

Stuck ? If you can't stop/restart a service correctly and can update this one manually, then delete it via a console, Click next Refresh in the Package Center and reinstall it:

  • ls -la /var/packages/<package_name>/target   => this is showing you the volume<x> where it's installed
  • rm -R /var/packages/<package_name>
  • rm -R /usr/syno/etc/packages/<package_name>
  • rm -R /volume<x>/@appstore/<package_name>
  • rm -f /usr/syno/synoman/webman/3rdparty/<package_name>
  • rm -f /usr/local/<package_name>

Script & Package

I did create a "Synology Package" to be able to move packages easily from the DSM. You can find it on my own Synology Repository (See Blog's menu "SPK Server"). You will find the script in the Package if you "unzip" it, in \package\ui\

Package Mover

Package Mover

[EDIT 13-10-2017] I have added support in the package to start/stop/delete packages, display reverse and forward dependencies. Only delete a packages if you are screwed.

[EDIT 24-02-2018] The sources for my package are available on GitHub (named Package Manager).

[EDIT 23-12-2018] Since a recent update of DSM, the feature to list dependencies between packages does not work anymore.

41 thoughts on “Move a Synology Package from a volume to another

    • Hello Andrew,

      I take this opportunity to tell you "a big thx" for sharing in the first place on how to do this! It really helped a lot.
      If you pass by Bruxelles, I owe you some local beers ;)


  1. I tried installing the package on a test DS3617xs box. It didn't install and gave me the following error: Please install the following package(s) before installing this package: Init_3rdparty.

    I did some digging and I found a package source for it ( Init_3rdparty installed without a hitch and your package installed next without further errors.

  2. Most of my packages succesfully moved from volume 1 (a 2% life expectation left SSD) to volume 3 (a brand new SSD/volume to replace my old volume 1). However plex needs a bit more explaining for me if that's possible. I can stop the service, move it from volume 1 to volume 2 and then I see the package manager asking me to repair the broken plex package...

    I then tried manually installing the newest plex package, but whenever I do so it wants to install to volume 1 again. How exactly do I change that to volume 3? Hope to hear from you!

    So far a big thanks for your script!

    • With a previous version of my script, moving Plex just resulted in Plex not starting anymore.
      I fixed this problem (Plex not starting) bu manually installing the latest version *on the same volume*.
      Next, I did improve my script and was finally able to move Plex successfully.

      But notice that I don't have any plugin installed within Plex. Maybe there is a problem with moving the plugins ?

      Unfortunately, as I don't have several volumes anymore, it's difficult for me to reproduce anything :/

  3. hi
    i'd like to move deluge to volumeUSB1. is it possible? i've modded the script to allow usb1, but the package reads as needing repair :(

    • I really don't have experience with installing packages on a usb drive (Never tried/never read it was possible) and with deluge. You should parse all files of Deluge to find if the volume is used in any one.

      • Dan has patched the file mvpkg.php which is in my SPK. I presume he modified the following line to list the USB devices in addition to the Volumes:

        $volumeNames = shell_exec('df -la --output=target | grep volume');

        I will have a look and let you know (in your latest post in this thread).

  4. Hi, thanks for this great tool!

    I want to migrate my two disk NAS to btrfs, do you know if your tool works with moving the following packadges?

    Mailplus server


  5. Hi, I'm in the same position as most other here, I want to move my Surveillance Station on DSM 6.2.1 from volume 2 to volume 1.
    Now I moved the shared folder with the recordings and such ("surveillance") already to vol 1 using the system settings.
    I'm a little afraid to try out moving the Surveillance Station itself, as TONS of settings are stored there for each camera, and there is no way of backing them up beforehand.

    Has anyone tried it out with Surveillance Station on a new DSM like 6.2 yet? Thanks!

  6. I've tried to install the Mods-PackageManger using the latest DSM software and it installs correctly. However when I try to run the package I get the following error "Sorry, the page you are looking for is not found."

  7. I've been battling doing this manually for too long, wish i found this tool sooner.
    I've used this app to move Surveillance Station on 6.2, (note i backed up all the cam configs, and was already using a different volume for storage) however this amazing app did the rest.

    I also move mailstation and mail server with no issues.

    am about to move a big Plex install...

    • Notice that after moving Plex, the package could have troubles to restart. In that case, simply manually "upgrade" with the latest version of Plex (even if you already have that version). this "reinstallation", which occurs on the new volume, did fix the problem for me....

  8. Valery - Is there a chance you could add the Synology RS-2418+ to the repository so I could install this package on my NAS? Thanks!


  9. How does this package work (how do i use it)? I just installed it and i don't see the options to use it anywhere.

  10. Hi Valery
    I have issue with MODS Package Manager.
    I was moving packages from HDD volume to SSD volume without any issues.
    Then I have moved the Package manager and then I got the issue to run the package.
    Stop-Start does not work
    Re-install to SSD volume or HDD volume does not work.
    it displays the MVPKG.php only.

  11. Hi Valery
    MODS Package Manager was running till moving the package itself. from that time only php file is shown.
    any hints?

    • Alas no, sorry. I never tried that myself :D
      And I can't test it anymore as I have now only one volume remaining :/

      I presume you tried to uninstall "MODS Package Manager" and reinstall it ?

  12. I was researching how to move apps and came across a few pages that used the command line but your app was a user experience dream. Thank you.

    Some notes:
    1. I had to install the webstation app as a dependency (I already had Php 7 installed)
    2. Download station needed pointing to volume2 for its temporary file location. Stumbled across that before pulling volume1 out so don’t know if it would have self-corrected if it didn’t see volume1 anymore.

    once again, thank you!

  13. Hi there

    Great work, i'd love to check this out too, but the spk server is not responding. Is this still up for download?


  14. What would I need to change to alow copying to volumeUSB1? (sonarr and radarr)

    I did that manualy in the past, but this script seems to be a better idea.

    • There are a few changes to be done to support USB volumes...
      Mainly all Regular Expression matching "volume" should be replaced with "volume(USB)*"

      You can login into your NAS (e.g.: using putty) and go to the installation dir of the package to do the required changes:
      cd /var/packages/MODS_PackageManager/target/ui/

      Ex: in the file mvpkg.php (using vi) you have to add the pattern (USB)* in the line 321:
      if ( preg_match('/volume(USB)*\\d+/', $volumeName, $out) ) {

      etc... But as I am stuck at home (lock down in Belgium due to the coronavirus), I will take some time today to do all the changes and publish a new packages ;)

Leave a Reply to Rastislav Cancel reply

No Access

Your email address will not be published. Required fields are marked *