This tutorial has the purpose to install Manjaro with BTRFS file system, automatic subvolumes and Snapper rollout.
As you know Manjaro use Calamares for install and every program must have config somewhere
So, start booting with usb live, I’ve used Gnome Edition and stop to start installation, first we must open terminal:
sudo -i
nano /usr/share/calamares/modules/mount.conf
and past at the end of the file under the section “btrfsSubvolumes”, cancelling all the other entry after:
btrfsSubvolumes:
- mountPoint: /
subvolume: /@
- mountPoint: /home
subvolume: /@home
- mountPoint: /root
subvolume: /@root
- mountPoint: /srv
subvolume: /@srv
- mountPoint: /var/cache
subvolume: /@cache
- mountPoint: /var/log
subvolume: /@log
- mountPoint: /var/tmp
subvolume: /@tmp
- mountPoint: /var/lib/AccountsService
subvolume: /@var@lib@AccountsService
- mountPoint: /var/lib/gdm3
subvolume: /@var@lib@gdm3
- mountPoint: /.snapshots
subvolume: /@snapshots
When you edit /etc/calamares/modules/mount.conf, you must be very careful to respect space and tabulation or you will receive error during installation
For better use here you may find the file with correct space and tabulation:
https://u.pcloud.link/publink/show?code=XZ5S0aVZsykifrjkVJFKlWSCeMPsBBPmALf7)
You may change add or delete subvolumes that you need
After that you may start standard installation with BTRFS file system as usual
This is my /etc/fstab:
# disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=463B-45DB /boot/efi vfat umask=0077 0 2
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e / btrfs subvol=/@,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /home btrfs subvol=/@home,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /root btrfs subvol=/@root,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /srv btrfs subvol=/@srv,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /var/cache btrfs subvol=/@cache,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /var/log btrfs subvol=/@log,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /var/tmp btrfs subvol=/@tmp,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /var/lib/AccountsService btrfs subvol=/@var@lib@AccountsService,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /var/lib/gdm3 btrfs subvol=/@var@lib@gdm3,defaults,discard=async,ssd 0 0
UUID=4b4d8b13-5ec8-44c3-a397-e7655d65285e /.snapshots btrfs subvol=/@snapshots,defaults,discard=async,ssd 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
and this is my subvolume list:
   ~  sudo btrfs subvolume list /  ✔
[sudo] password di robertocannito:
ID 257 gen 766 top level 5 path @home
ID 258 gen 429 top level 5 path @root
ID 259 gen 79 top level 5 path @srv
ID 260 gen 765 top level 5 path @cache
ID 261 gen 766 top level 5 path @log
ID 262 gen 764 top level 5 path @tmp
ID 263 gen 737 top level 5 path @var@lib@AccountsService
ID 264 gen 10 top level 5 path @var@lib@gdm3
ID 265 gen 756 top level 5 path @snapshots
ID 275 gen 766 top level 5 path @
ID 302 gen 463 top level 265 path @snapshots/1/snapshot
ID 303 gen 464 top level 265 path @snapshots/2/snapshot
Soon after first boot, remove timeshift and timeshift-autosnap and reboot
Now let’s start installing:
$ sudo pacman -S snapper
$ sudo pacman -S btrfs-assistant
$ sudo pacman -S grub-btrfs
$ sudo pacman -S snap-pac
$ sudo pacman -S --needed base-devel git
$ pamac build snapper-support
We need to unmount and delete .snapshots, because must re created again later
$ sudo umount /.snapshots
$ sudo rm -rf /.snapshots
Let’s create a new root config …
$ sudo snapper -c root create-config /
$ sudo btrfs subvolume delete /.snapshots
$ sudo mkdir /.snapshots
$ sudo chown root:root /.snapshots
$ sudo chmod 750 /.snapshots
sudo mount -a
$ sudo systemctl enable --now snapper-timeline.timer
$ sudo systemctl enable --now snapper-cleanup.timer
reinstall again grub-btrfs
$ sudo pacman -S grub-btrfs
Set the location of the directory containing the grub.cfg file in /etc/default/grub-btrfs/config.
sudo nano /etc/default/grub-btrfs/config
Example: My grub.cfg is located in /efi/grub …
GRUB_BTRFS_GRUB_DIRNAME="/boot/grub"
sudo systemctl enable --now grub-btrfsd.service
sudo chmod 750 /.snapshots
sudo nano /etc/snapper/configs/root
Place your username between the quotation marks
ALLOW_USERS="your_username_here"
Zesko suggestion:
You need to manually configure Subvol-Mapping in the config file /etc/btrfs-assistant.conf
:
For example:
<Snapper config name> = "<snapshot-subvolume>, <subvolume>, <UUID>"
[Subvol-Mapping]
root = "@snapshots,@,4b4d8b13-5ec8-44c3-a397-e7655d65285e"
home = "@home-snapshot,@home,4b4d8b13-5ec8-44c3-a397-e7655d65285e"
...
It tells btrfs-assistant
to find snapshots in your custom layout.
That is all, I’ve tested on my two notebooks and different virtual machine and I hope this will help you in this matter