Friday, October 31, 2014

How to move Surveillance Station installation from one volume to the other in DSM 5.0

Suppose you would want to move all contents of a volume in a Synology NAS to another volume, because you are swapping disks or for other reasons.

You should first move all shared folders to the other volume (which is not described here). This can be done through the GUI.
However suppose you installed a package in the volume you would want to remove, there is nothing in the GUI that let you move this package to another volume.

To be able to do that login in to the shell, which is possible through ssh (once you enabled it in the GUI).
The following example is for the Surveillance Station application, which we will move from volume2 to volume1.

  1.  Take a backup of all your precious data
  2. Login to the terminal as root
  3. Stop Surveillance station:  "/var/packages/SurveillanceStation/scripts/start-stop-status stop"
  4. Move the package:  "mv /volume2/@appstore/SurveillanceStation/ /volume1/@appstore/"
  5. Remove the system symlink: rm -fv /var/packages/SurveillanceStation/target
  6. Point the system symlink to the new location:  "ln -s /volume1/@appstore/SurveillanceStation /var/packages/SurveillanceStation/target"
  7. Start Surveillance Station: "/var/packages/SurveillanceStation/scripts/start-stop-status start" 

11 comments:

  1. Step 4 must be:
    Move the package: "mv /volume2/@appstore/SurveillanceStation/ /volume1/@appstore"

    Oterhwise the content of SurveillanceStation gets moved to @appstore

    ReplyDelete
    Replies
    1. Hi,
      mv /volume2/@appstore/SurveillanceStation /volume1/@appstore/
      Or
      mv /volume2/@appstore/SurveillanceStation/ /volume1/@appstore

      Give the same results

      Delete
    2. This comment has been removed by the author.

      Delete
    3. This comment has been removed by the author.

      Delete
    4. Similar to what "Unknown" mentions I ended up with the contents of the SurveillanceStation folder moved directly into @appdata on the destination volume.

      Playing around with it a bit I found that it works if using the full paths. This is what I ended up with:

      Moving from volume1 to volume2:
      /var/packages/SurveillanceStation/scripts/start-stop-status stop
      mkdir /volume2/@appstore/SurveillanceStation
      mv /volume1/@appstore/SurveillanceStation/ /volume2/@appstore/SurveillanceStation/
      rm -fv /var/packages/SurveillanceStation/target
      ln -s /volume2/@appstore/SurveillanceStation /var/packages/SurveillanceStation/target
      mv /volume1/@surveillance/ /volume2/@surveillance/
      rm -fv /volume2/@appstore/SurveillanceStation/@surveillance
      ln -s /volume2/@surveillance /volume2/@appstore/SurveillanceStation/@surveillance
      /var/packages/SurveillanceStation/scripts/start-stop-status start

      Moving back from volume2 to volume1:
      /var/packages/SurveillanceStation/scripts/start-stop-status stop
      mkdir /volume1/@appstore/SurveillanceStation
      mv /volume2/@appstore/SurveillanceStation/ /volume1/@appstore/SurveillanceStation/
      rm -fv /var/packages/SurveillanceStation/target
      ln -s /volume1/@appstore/SurveillanceStation /var/packages/SurveillanceStation/target
      mv /volume2/@surveillance/ /volume1/@surveillance/
      rm -fv /volume1/@appstore/SurveillanceStation/@surveillance
      ln -s /volume1/@surveillance /volume1/@appstore/SurveillanceStation/@surveillance
      /var/packages/SurveillanceStation/scripts/start-stop-status start

      Delete
  2. Hi, may I ask if it's possible to move them via WinSCP? And is the Symlink really necessary, if I plan to recreate volume 1 and move all packages back to it?
    Thank you!

    ReplyDelete
  3. May I add, that "Unknown" is right, if you don't write the "/" at the end of "Surveillance Station/ /volume1/", all gets written directly in the @appstore folder, not in the newly created "SurveillanceStation" folder?

    ReplyDelete
    Replies
    1. That's weird for me it's not a problem

      prodCam> find ./
      ./
      ./survstation
      ./survstation/test
      ./@appstore
      prodCam>
      prodCam>
      prodCam>
      prodCam> mv /tmp/testdir/survstation /tmp/testdir/@appstore/
      prodCam> find ./
      ./
      ./@appstore
      ./@appstore/survstation
      ./@appstore/survstation/test

      Delete
    2. This is tested with some test folders

      Delete
  4. Thank you, maybe I can try again with a different Diskstation.

    What about the symlinks? If I just move the apps to another volume temporarily, is it enough to move the apps to volume 2, delete volume 1, recreate it (with BTRFS) and then move the apps back to volume 1?
    Or do I have to create new symlinks anyway?

    ReplyDelete
  5. in DSM 6.0:
    https://ahkhai.com/2016/02/11/change-surveillance-station-directory/

    ReplyDelete