How do i get snapper to work on arch

submitted 3 months ago by Kiuyn@lemmy.ml edited 3 months ago

Hi everyone, hope you guys have a nice day! Long story short. I hop from opensuse tumbleweed to arch recently. I want to setup snapper so it work like on opensuse just to be safe. Even on opensuse the rolling release did kill my system few time. I run into this part on the arch wiki.

Note: If you are using the suggested Btrfs partition layout from archinstall then the @.snapshots subvolume will already be mounted to /.snapshots, and the snapper create-config command will fail [1]. To use the @.snapshots subvolume for Snapper backups, do the following:

Unmount the @.snapshots subvolume and delete the existing mountpoint.
Create the Snapper config.
Delete the subvolume created by Snapper.
Re-create the /.snapshots mount point and re-mount the @.snapshots subvolume.

I did installed arch via archinstall but I am not really experience with the btrfs files system nor mount or unmount stuff so as I expected I killed my system. I reinstalled arch and not sure how to setup snapper without pull my hair out again. Any help would be appreciate thank!

7

Log in to comment

6 Comments

3 months ago

umount /.snapshots
rm -r /.snapshots
snapper -c root create-config /
mount /.snapshots
snapper -c root create --description "initial baseline"

You may also want to check out the snap-pac package I think that automatically takes snapshots every time you install something

3 months ago

thank i will try right now

3 months ago , edited 3 months ago

I tried and it worked thank a lot you help me a ton! i have one last question when i try to roll back via BTRFS Assistant there is a pop up like this:

It appears you are currently mounting by subvolid. Doing a restore in this case may not produce the expected outcome. It is highly recommended you switch to mounting by subvolume path before proceeding!

do that mean i did something wrong?

3 months ago

Here is what chatgpt says about your error message:

In Btrfs (a modern Linux filesystem), subvolumes can be mounted using either their subvolume ID (subvolid) or their subvolume path (subvol):

•	Mounting by subvolid: Uses a unique numerical identifier assigned to each subvolume.
•	Mounting by subvolume path: Uses the filesystem path to the subvolume.

Why is this important when performing a rollback?

When you mount by subvolid, the mount point is tied to a specific subvolume ID. If you perform a rollback or restore, the subvolume IDs can change because new subvolumes (snapshots) are created or old ones are replaced. This can lead to unexpected behavior, such as the system booting into the wrong snapshot or failing to boot altogether.

Mounting by subvolume path is more reliable in this context because the path remains consistent even if the underlying subvolume ID changes.

Did you do something wrong?

Not necessarily. Mounting by subvolid isn’t incorrect in general use. However, when dealing with rollbacks or restores, it can cause issues due to the reasons mentioned above. The warning is advising you to switch to mounting by subvolume path to ensure the rollback proceeds smoothly.

What should you do next?

It’s recommended to switch your system to mount by subvolume path before proceeding with the rollback. Here’s how you can do that:

Steps to Switch from Subvolid to Subvolume Path

1.	Identify Your Current Subvolume Path:
•	Open a terminal.
•	Run the command:

sudo btrfs subvolume list /

•	Look for the subvolume with the ID you’re currently mounting. Note its path.

2.	Edit the /etc/fstab File:
•	Back up your current fstab file:

sudo cp /etc/fstab /etc/fstab.backup

•	Open the fstab file with a text editor:

sudo nano /etc/fstab

•	Locate the line that mounts your Btrfs filesystem. It will have an option like subvolid=....
•	Change subvolid=... to subvol=... and specify the subvolume path you noted earlier. For example:

Before:

UUID=xxxxxxx / btrfs defaults,subvolid=256 0 0

After:

UUID=xxxxxxx / btrfs defaults,subvol=/@ 0 0

3 months ago

Use BTRFS Assistant, so easy to use.

3 months ago

That was my initial plan but like the arch wiki said it cant use snapper unless i figure out how to do this

Unmount the @.snapshots subvolume and delete the existing mountpoint.
Create the Snapper config.
Delete the subvolume created by Snapper.
Re-create the /.snapshots mount point and re-mount the @.snapshots subvolume.

which i cant do because i am kinda dumb :)