NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

Sandshark's avatar
Sandshark
Sensei - Experienced User
Oct 17, 2019

How to save your apps when destroying your main volume (OS6)

Normally, destroying your primary volume will remove all your apps. Well, I don't think it actually totally removes all traces of them, it does delete their folders in /apps, and it must do something to remove them from the GUI database. I have discovered a way to retain your apps in this situation.

 

While this is a straightforward process, I take no responsibility if it doesn't work for you.  This is not a good time for someone unfamiliar with the Linux command line to try and become familiar with it.

 

For my example, my main volume I plan to destroy is /data and I added a second called /vol2 that will become the new main one. Substitute your volume names as needed.

 

The /apps directory in the main volume holds the files for your apps so that they don't fill the OS partition. In my case, thats /data/apps. But the real location of them is a BTRFS subvolume called /data/.apps (the leading dot makes it invisible to many operations), which is mounted to /apps by a .mount file /etc/systemd/system/multi-user.target.wants/apps.mount. When you destroy your primary volume, the OS creates a new subvolume for them (/vol2/.apps in my case) and updates the .mount file, but it does not copy your apps to it.

 

The simple solution is to create the new subvolume yourself, copy the contents of /apps to it, and modify /etc/systemd/system/multi-user.target.wants/apps.mount to point to the new location. Then re-boot so the new location gets actually mounted before destroying the main volume. When you copy the files, there are several invisible files you also may need to copy (I did, and I suggest you do, too). So, using my example volume names, here are the steps from SSH. Note that I have the nano editor installed (apt-get install nano), but you can use vi or an editor of your choice.

 

  • # btrfs subvolume create /vol2/.apps
  • # cp -rT /apps /vol2/.apps
  • # ls /apps -all
  • # ls /vol2/.apps -all

Now, make sure everything was copied by comparing the directory listings. DO NOT reboot until you complete the next step.

 

  • # nano /etc/systemd/system/multi-user.target.wants/apps.mount

Change /data/.apps to /vol2/.apps and save.

 

Reboot.

 

From the GUI, go to the Apps tab and make sure you see your apps and available apps. Might be good to see at least one works.

Now, on the System/Volumes tab, DESTROY your main volume. That takes a bit of time. Then, verify you still can see your apps. Finally, reboot again and re-check the apps.

 

Note, it is very important to check the things I have listed along the way. If you mess up, you'll lose the apps. And once you lose them, putting another copy back in the /apps folder doesn't work, because the GUI database never updates to show them.

 

If you have three or more volumes and you guessed wrong as to which the OS would decide is your new main volume, no problem. Just copy the /apps contents to the new /mainvolume/.apps directory and edit /etc/systemd/system/multi-user.target.wants/apps.mount again to point /apps to /mainvolume/.apps and re-boot. You could probably leave them in the other location, but I don't know what would happen with an OS update or installation of another app.

5 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User

    If you have two volumes, I think that the NAS already will migrate /apps to the remaining volume if you delete the first (primary) one.  Though it's been a while since I tried that.

    • Sandshark's avatar
      Sandshark
      Sensei - Experienced User

      I only tried this on a virtual machine, but it did not migrate the apps when I destroyed the main volume in OS 6.10.1.

       

      I'll have to give it a shot on a real NAS when I have a chance, but I don't know why it would behave any differently.

      • StephenB's avatar
        StephenB
        Guru - Experienced User

        Sandshark wrote:

        but I don't know why it would behave any differently.


        Me either, but I did find that the NAS did migrate my apps automatically (quite a while ago).

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More