Is it completely safe to snapshot a container when it’s running? My intuition tells me that it’s probably not safe because some processes may be in the middle of the work, but stopping the container automatically before each snapshot and restarting it after, also is not perfect. Do you stop your containers for snapshotting?
It’s usually fine to have them run during a snapshot.
The filesystem state should generally be consistent either because Incus works with it to perform the snapshot (zfs, btrfs) or because the snapshot is just a clean copy (dir) or because Incus tells the kernel to hold all writes temporarily (lvm, ceph).
Obviously all that does is make sure that there is no filesystem corruption. There may still be some data that’s halfway through being written by userspace or things that are just kept in memory and that won’t be flushed until much later, but normally this kind of issue isn’t a huge concern as the software will still read the data just fine, it just will be missing the most recent change.
1 Like