I use linux as my default OS for more than 2 years. Now my manjaro system is installed on btrfs and use snapper instead of timeshift, but is it a good way to use snapper while still using manjaro defaults subvolume layout? I planing to reinstall manjaro and use snapper (I hope) in the correct way. But I have some confusion related to snapper and btrfs subvolume layout.
My plan is to install manjaro-kde with btrfs file system, wich manjaro default btrfs subvolume is look like this:
subvolume |mountpoint
@ |/
@home |/home
@cache |/var/cache
@log |/var/log
What I want to do after installation is:
- Complately remove timeshift and install snapper.
- Change the defaults subvolume layout into flat layout.
I want use flat layout according to these posts:
I’ll do this way(chroot mode):
- Create new @var and @snapshots subvolume
- Move everything in @/var/ to new @var
- Move everything in @cache to @var/cache/
- Move everything in @log to @var/log/
- Last but but least edit fstab file to mount @var → /var
Now the subvolume layout will look like this:
subvolume |mountpoint
@ |/
@home |/home
@var |/var
@snapshots |will be used latter for saving snapshots mount at /.snapshots
@cache |not used
@log |not used
- 1st question: did I chage the defaults layout to flat layout in the correct way? and is it right to call that a flat layout?
- 2nd question: why it is necessary to add attribute +C to /var? can I set no-COW for @var by mount options in fstab instead?
With the above subvolume layout, it will exclude @var from being snapshoted by snapper since it is a subvolume, but Hagen also explain:
/var/lib must be snapshotted with our root system because we don’t have to break dependencies of installed library configuration or more important the pacman/pamac config files of installed packages of our current system
So I need to include /var/lib in every snapshot, to do so I need to copy all in /var/lib/ to /usr/var/lib/ then add a line in fstab to make a bind-mount from /usr/var/lib to /var/lib.
/usr/var/lib /var/lib none defaults,bind 0 0
- 3rd question: is bind-mount the same as we mount a partition or subvolume into a directory? so if I bind-mount /usr/var/lib to /var/lib and then I create a file in /var/lib that file will actually saved in /usr/var/lib?
If I’m not wrong, after all that steps that means all preparation to use snapper is set up correctly, and ready for boot into new manjaro system and then create snapper config for /
Acording to archwiki if I use snapper-timeline.timer rather than default cronie deamon I can be able to change snapshot and cleanup frequencies, problem come if snapper-timeline.timer is running, snapper will take 2 snapsots in every hour, 1 is created by default cronie deamon and another one by snapper-timeline.timer. To prevent that happend, I follow this post. Problem Solve, but I want snapper to only take snapshot in every 6hours, and I dont know how to do that. I have try to understand the steps from some wiki pages:
ArchWiki - Snapper#Change_snapshot_and_cleanup_frequencies
ArchWiki - Systemd#Editing_provided_units
ArchWiki - systemd.time.7
But always ended up with faileure.