On Thu, Nov 2, 2017 at 7:07 AM, Austin S. Hemmelgarn <ahferro...@gmail.com> wrote: > On 2017-11-01 21:39, Dave wrote: >> I'm going to make this change now. What would be a good way to >> implement this so that the change applies to the $HOME/.cache of each >> user? >> >> The simple way would be to create a new subvolume for each existing >> user and mount it at $HOME/.cache in /etc/fstab, hard coding that >> mount location for each user. I don't mind doing that as there are >> only 4 users to consider. One minor concern is that it adds an >> unexpected step to the process of creating a new user. Is there a >> better way? >> > The easiest option is to just make sure nobody is logged in and run the > following shell script fragment: > > for dir in /home/* ; do > rm -rf $dir/.cache > btrfs subvolume create $dir/.cache > done > > And then add something to the user creation scripts to create that > subvolume. This approach won't pollute /etc/fstab, will still exclude the > directory from snapshots, and doesn't require any hugely creative work to > integrate with user creation and deletion. > > In general, the contents of the .cache directory are just that, cached data. > Provided nobody is actively accessing it, it's perfectly safe to just nuke > the entire directory...
I like this suggestion. Thank you. I had intended to mount the .cache subvolumes with the NODATACOW option. However, with this approach, I won't be explicitly mounting the .cache subvolumes. Is it possible to use "chattr +C $dir/.cache" in that loop even though it is a subvolume? And, is setting the .cache directory to NODATACOW the right choice given this scenario? From earlier comments, I believe it is, but I want to be sure I understood correctly. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html