Seperate subvolume for /var

Currently /var/cache, /var/log and /var/tmp have their own subvolume. But there should be one subvolume for the whole /var dir.

This is the dir where applications write additional files that need to be persistant, even after restoring a snapshot. For example, Anbox stores all the Android's files in /var/lib/anbox which includes personal files like chat history and they all should not be vanished after restoring a snapshot. Luckily I haven't had such a loss but this loss could be critical.

I suggest to replace these subvolumes with:
@cache @log @tmp @var for /var
@tmp for /var/tmp /tmp

I don't think you want to exclude the whole of /var from snapshots. There are other things under /var that should be in the snapshot for system integrity. If you have specific things you want excluded, I would recommend creating subvolumes for those indivually.

Unless they are globally applicable, it is fairly easy to do this after the fact if desired.

According to file-hierarchy(7) — Arch manual pages


Persistent, variable system data. Must be writable. This directory might be pre-populated with vendor-supplied data, but applications should be able to reconstruct necessary files and directories in this subhierarchy should they be missing, as the system might start up without this directory being populated. Persistency is recommended, but optional, to support ephemeral systems. This directory might become available or writable only very late during boot. Components that are required to operate during early boot hence shall not unconditionally rely on this directory.

So, it's unlikely that an application could break if something gets messed up here, as it should not rely on /var.

For a newbie, using apps like Anbox, virt-manager, etc., without knowing their personal files are stored in /var too, this could really make a loss.

I saw that OpenSUSE uses @var for the whole /var, so that's why I think this would be safe to be excluded from snapshots.

Are you speculating or have you thoroughly tested it? I have. You won't end up with a broken system but you will end up with oddities. I wouldn't describe it as "newbie friendly" if that is what you are going for.

For one, pacman isn't super appreciative of it's directory being missing.

In my experience, it is even uglier when you have a /var that is significantly newer than the rest of your system. It has been a while since I tried it but I remember seeing lots of odd behavior.

The other problem is, unlike @home, timeshift won't take snapshots of it at all so you lose the ability to recover from accidental data loss. Currently, if someone breaks something in /var, they can restore a snapshot and it will be fixed.

Opensuse uses snapper instead of timeshift so end-users have the ability to choose to take snapshots of @var if they choose.