Move Synology packages between volumes
I’ve had Synology devices for years, and always transferred the disks from one NAS device to another. That caused that I haven’t been able to use the btrfs file system with all its benefits and was still on ext4.
During my latest disk expansion I’ve created another volume so that I have two volumes, /volume1, which consists of 90% of the space of my disk pool, and /volume2 for the other 10%.
I’m now in the process of making a full backup of Volume 1, so that I can delete it, and then create a btrfs volume instead. As I can’t delete all packages, I’ve looked up how to move packages between volumes.
This site gave me some nice hints, but I found out it wasn’t yet enough. So I’ll share my experiences here.
All Synology packages are having a folder inside /var/packages. That’s useful. By for example checking through
ls -aRl /var/packges | grep volume1
you can check if there are still packages on volume1.
Packages also have folders on the volumes, mostly in /volume1/@app* folders. So there’s @appstore, @appconf, @apphome, @appdata and @apptemp. Symlinks to the corresponding folders are inside the /var/packages folder. So that means that most of the actual package data is stored on the volumes itself, whereas the /var/packages folder only contains the administration of which packages exist and which folders they use.
In case of, for example, package HyperBackup, I didn’t want it to be uninstalled. I’d rather keep it available, as you might understand. To move it to the other volume anyways, I’ve executed the following steps:
-
Stop the package in DSM in the package manager. Don’t uninstall it, but stop it.
-
Close the package manager window in DSM, else it’ll start complaining
-
Go in an SSH shell to
/var/packages/<packagename>, so in this casecd /var/packages/HyperBackup -
Execute the following:
mv "/volume1/@appconf/HyperBackup" "/volume2/@appconf/" && \ mv "/volume1/@apphome/HyperBackup" "/volume2/@apphome/" && \ mv "/volume1/@appstore/HyperBackup" "/volume2/@appstore/" && \ mv "/volume1/@apptemp/HyperBackup" "/volume2/@apptemp/" && \ mv "/volume1/@appdata/HyperBackup" "/volume2/@appdata/" && \ rm etc home target tmp var && \ ln -s "/volume2/@appconf/HyperBackup" etc && \ ln -s "/volume2/@apphome/HyperBackup" home && \ ln -s "/volume2/@appstore/HyperBackup" target && \ ln -s "/volume2/@apptemp/HyperBackup" tmp && \ ln -s "/volume2/@appdata/HyperBackup" var -
Re-open to the package manager in DSM and go to the package
-
See that the package is now on Volume 2.
-
Start the package
Some packages may have some more issues and may need to be repaired in the package manager. If you executed the above code, a repair will be easy.
In case of the Docker package, I found that it also created a symlink to /volume1/@docker somewhere in the @appdata folder I believe. You’ll want to update that manually as well.
Good luck!