Resin-data for app remains even once device is "moved" between apps

Hi All,

I’ve just noticed that even after we’ve moved a device from one app to another, the data associated with the “old” app is still there:

root@2c877ee:/mnt/data/resin-data# ls -ltrh
total 12K
drwx--x--x 11 root root 4.0K Apr 25 08:23 155867
drwx--x--x 11 root root 4.0K May 12 07:29 310575
drwxr-xr-x  2 root root 4.0K May 12 08:16 resin-supervisor

Is there a way to stop this, short of manually deleting the old app? As we’re pulling a lot of containers, we’ve got about 4GB of space used by the old app that’s kind of wasted.

Thanks!

Yes, that’s intentional, as we don’t delete data unless you explicitly ask for that with a purge (e.g. in the dashboard or theough the API). It’s common for moving devices back and forth between apps and this is the “path of least surprise”. :fishing_pole_and_fish:

Also, this behaviour is in our docs: Moving to another application (the note highlight in that section)

Ok, makes sense for the majority of use-cases I guess, just not ideal for ours.

Could you guys consider adding a hook, which would allow an application to intercept a “move” event, and clean up after itself before it is moved?

Certainly! I’ve taken a note for our developers. :mailbox_with_mail:
Can you give us some info/context on your use case?

We’re running a docker-in-docker setup, and we’re first sending devices into a staging environment (i.e. Application), and then graduating them to the production application by “moving” them into that app.

Because of the way the data partition is mounted into the application, our docker image cache can not be reused by different applications after moving, so each app causes the full set of docker images to be built or downloaded - which is around 3GB worth of data.

The way purge seems to work, is that it only purges the data for the current app, this is evidenced by the following device, which was purged a couple of hours ago, but still has data from “old” apps stored:

root@efd141c:/mnt/data/resin-data# ls -ltrh
total 24K
drwx–x--x 11 root root 4.0K Apr 9 14:42 310575
drwx–x--x 10 root root 4.0K Apr 20 20:39 198163
drwxr-xr-x 2 root root 4.0K Apr 21 10:41 345894
drwx–x--x 11 root root 4.0K Apr 30 09:19 278971
drwx–x--x 11 root root 4.0K May 12 08:29 155867
drwxr-xr-x 2 root root 4.0K May 12 09:35 resin-supervisor

If there was a hook on “move app”, then we could delete our local docker cache before the move happens, which would at least free up the ~3gb image cache. In order to do this with the current purge function, we’d have to purge the data, and then quickly move the App before anything further is downloaded - which doesn’t really seem like a very clean approach.

Thanks for the feedback :slight_smile:

Hey guys,

And how about the option of keeping the information in the /data folder available after moving it to a new application? This would definitely help me. Now I have to manually copy the /data folder, then move the device, then put all the files back in the /data folder.

Thanks