What happens to snap data during refresh

I have a daemon app that’s supposed to run indefinitely in the background.

Based on my understanding, the daemon will be restarted per refresh.

I assume that the read-only data (eg in $SNAP) will be replaced while the daemon is shut off. Is that correct?

What about the writable data? Will the files in $SNAP_DATA be copied over to the new revision before my daemon starts?

yes, the services are stopped, then the data is copied from ~/snap/<snapname>/<oldversion> to ~/snap/<snapname>/<newversion> and the .../current symlink is updated to point to <newversion>
only then the services are started again.

(one thing to keep in mind is that the old version dir is not accessible for the service after the update so make sure your configuration files of the service point to the /current symlink to not have your service try to open files from any versioned dir)

1 Like