← Back to team overview

cloud-init team mailing list archive

Re: Moving of stored data


On 3/1/23 12:05, Neal Gompa wrote:
On Wed, Mar 1, 2023 at 12:10 PM Robert Schweikert <rjschwei@xxxxxxxx> wrote:
/var/lib is discarded between reboots the data in /var/cache is
available after reboot into the new snapshot. Meaning if the cloud-init
data is not moved then it always looks like a new instance is being booted.

That sounds like a flaw in transactional-update. As a user, I would be
very surprised to see persistent data being thrown away. I would
expect /var/cache to be emptied, but not /var/lib. I think you need to
go back and fix that instead.

Indeed. /var/lib is where we store things like package manager metadata, logrotate state, and much more. While it is true that /var is meant to contain things frequently updated (as opposed to the relatively static /etc), /var itself is not ephemeral and must survive reboots for stateful machines/VMs. Specific directories within /var might be ephemeral or mounted as tmpfs, such as /var/run or perhaps even /var/cache.

/var/lib, however, should be preserved. It sounds like /var/lib and /var/cache are being used backwards in the situation described.