BTRFS subvolume for some applications, out of home

Is possible to install packages in another subvolume with BTRFS?

I noticed that when I restore a snapshot for /home subvolume, this causes a problem with Firefox profile/history and profile sync daemon.
This problem also happens with Signal application, in which some messages are lost.

So, basically what I in theory need is to create a new subvolume, and change the path dir from these two applications from /home to a new location?

I have a subvolume at the root of the BTRFS partition for my Firefox configs/profiles called @mozilla which I mount at ~/.mozilla.
I do have another called @var for my flatpaks configs which gets mounted at ~/.var.
I have done so in order to being able to share the configs between several systems in a multiboot setup.
It works fine.

Not sure though if that is what you are looking for to do.

1 Like

This is exactly what I’m looking for but for other purpose, which is to be able to restore a snapshot for /home subvolume and don’t affect this two applications, which would be stored in different subvolume.

1 Like

I guess then it should work for your intended purpose as well. Those subvolumes shouldn’t get snapshotted when you snapshot your @home.

1 Like

I suppose it will, I didn’t think it was possible…

But how can I do it?
I can see that there is a .mozilla folder inside ~/.config and another on inside ~/.cache

Should I create a snapshot for it inside ~/.config and another inside ~/.cache, and move the contents from the existing folders to it ?

There might be other ways of doing this as well but this is how I did it:

First I mounted the root of the BTRFS partition at /mnt:
sudo mount -t btrfs /dev/sda2 /mnt

Then I created those subvolumes at /mnt .

Next, I moved the content of (in my case) .mozilla and .var into those subvolumes.

After that, I created proper entries in fstab for them. Example:

UUID=0d19c35e-8b2b-4844-a2e6-359ae17575e1 /home/pebcak/.mozilla btrfs defaults,noatime,compress=lzo,subvol=/@mozilla

If I remember correctly, I needed to chown the mount ~/.mozilla to my user for getting rw access.

1 Like

hm, that is nice, so the application will know where the files are because the folder path is the same.

My /var/cache and /var/log are already subvolumes since I’m using the default calamares BTRFS subvolumes layout.

I’ll definitely try it :slight_smile: thanks pebcak

1 Like

You might perhaps want to make a backup of those configs somewhere else before moving them around.
You never know so it’s better to play it safe. Good luck!

1 Like

I’ll do it.

Thanks, really appreciate it

1 Like

I see @dalto typing, so you could perhaps wait before implementing the above :blush: :sweat_smile:

Indeed, hehe :slight_smile:

1 Like

There are two ways to do this.

The first is to use flat subvolumes. Basically create new subvolumes at the root of your btrfs partition and then mount them in /etc/fstab or with mount units. This is what @pebcak has described.

You can also create a nested subvolume. In this case you would just create a subvolume at /home/myuser/.mozilla. In this case, you would not need to mount anything. It “just works”.


Thanks Dalto and pebcak, this will save me from headaches when restoring /home subvolume.

Based on what has been said here, I’ll try the nested subvolume approach first, it sounds easier than having to boot into live USB, mount the subvolid 5, create the subvolume and configure it into fstab.


I think nested is a good choice if I understand your use case. That being said, you only need to mount the live ISO if you are moving data that you can’t change in a running system. In this case, that shouldn’t be required.


Its working :slight_smile:
1- systemctl --user stop psd
2 - Backup of the folder ~/.mozilla
3- removed the folder
4- created a subvolume with btrfs subvolume create .mozilla inside /home/myuser (without sudo)
5- changed the permissions to chmod -R 700 /home/myuser/.mozilla
6- copied with cp -R /mybackup/.mozilla/extensions and /mybackup/.mozilla/firefox to the new folder and its working perfectly :slight_smile:


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.