teejee2008 / timeshift

System restore tool for Linux. Creates filesystem snapshots using rsync+hardlinks, or BTRFS snapshots. Supports scheduled snapshots, multiple backup levels, and exclude filters. Snapshots can be restored while system is running or from Live CD/USB.
GNU Lesser General Public License v3.0
4.68k stars 281 forks source link

Consider making snapshots read-only #533

Open BareRose opened 4 years ago

BareRose commented 4 years ago

Is your feature request related to a problem? Please describe. Currently btrfs snapshots created by Timeshift are read-write. This causes them to grow in size when browsing through them - e.g. to restore an individual file - due to atime updates. It also makes it impossible to use them with btrfs send as that command requires read-only snapshots.

Describe the solution you'd like Simply create read-only snapshots. If I understand the code correctly, all that would be needed is to change line 1501 in Main.vala from this: string cmd = "btrfs subvolume snapshot '%s' '%s' \n".printf(src_path, dst_path); to this: string cmd = "btrfs subvolume snapshot -r '%s' '%s' \n".printf(src_path, dst_path);

Describe alternatives you've considered An alternative to address the bloat issue would be to mount /mnt/timeshift/backup with the noatime option, thus preventing atime updates. However read-only snapshots make much more sense, and appear to be standard practice for btrfs backup/snapshot utilities anyway (btrbk uses read-only snapshots, for example).

BareRose commented 4 years ago

Turns out mounting /mnt/timeshift/backup with noatime is probably a good idea eitherway as it prevents undesired atime updates to the mounted subvolumes.

A temporary workaround is to add a line for /mnt/timeshift/backup in /etc/fstab with the noatime option (and whatever desired options). Kinda dirty but does prevent unintended atime updates to both the system and snapshots.

bobberb commented 3 years ago

@teejee2008 in which situation is it desirable to have a read-write snapshot?

gitbjo commented 2 years ago

@teejee2008 in which situation is it desirable to have a read-write snapshot?

As BareRose mentioned, not having it readonly prevents brtfs send for backup or copying to another disk. Additionaly, a snapshot on a given date/time should not be modified, as in this case, it does not represent the state in a point of time.

ghost commented 2 years ago

Will there be any progress with this now that Linux Mint took over the gig?

reduakt commented 2 years ago

zfs snapshots are RO snapper snapshots are RO

A snapshot is like a photo of the filesystem at a particular point in time.

Timeshift uses RW, but in general we should not be able to alter an earlier point in history. A snapshot is a 1:1 capture of the files of a filesystem and by default it is no joy to know that the all my snapshot can be gone if something bad happens in /run/timeshift/... They are all writeable and automounted by timeshift there .....