First experiment with installing on BTRFS

Great to know that it works! Thanks for the reply! I appreciate it.

2 Likes

Please note that the compression will only affect new files from the point of adding this to your fstab.

To recompress the filesystem to zstd run …
sudo btrfs filesystem defragment -r -v -czstd /

To check the compression ratio/size, install compsize
sudo pacman -S compsize
and run …
sudo compsize -x /

3 Likes

That’s great! Thanks a lot for pointing it out! Can this be done on a running system or should I use a live usb for doing this?

No need for a live usb; you can run a defrag/compress from within the system.

Btw, the above-mentioned command combines defragmentation and compression; you compress a btrfs file system to increase its effective capacity, and you can defragment it to increase I/O performance.

2 Likes

Thank you for the explanation!

I am glad that I went with btrfs. I’m having a blast learning a bunch of new things. Thanks to all of you.

:purple_heart:

4 Likes

Another question regarding grub-btrfs and Timeshift snapshots:
Reading

Automatically update grub

If you would like Grub to automatically update when a snapshot is made or deleted:

I am a bit at a loss to understand how I am going to make this work. When making the snapshots, Timeshift gave me the following options for their location:

timeshift-snapshot-location

nvme0n1p4 is where the system is installed.

Do I need to make a directory .snapshot under / and mount the partition there via fstab?

I haven’t created any subvolumes for the snapshots so I guess they are stored under / but I can’t see them running ls / .

all I did when using the wizard was select my OS partition and finish the wizard. I didn’t manually create any special folder or sub-volume. I’ve use the grub-btrfs at least 3 times and so far the rollbacks have worked perfectly.

This is what I did as well.
But would you get a new snapshot boot entry automatically after creating an snapshot with Timeshift?
The text I quoted got me confounded a bit.

From time to time, it might be useful to balance the file system, especially if you have lots of snapshots.

You can see the effect of balancing when you look at “allocated” and “used” space, as well as “unallocated” and “free” space.

Example:
Before balancing:

Overall:
    Device size:		     476.44GiB
    Device allocated:		 231.04GiB
    Device unallocated:		 245.40GiB
    Used:			         211.12GiB
    Free (estimated):		 264.23GiB

Run
sudo btrfs balance start -musage=60 -v /path and sudo btrfs balance start -dusage=60 -v /path
and check again:

Overall:
    Device size:		     476.44GiB
    Device allocated:		 225.04GiB
    Device unallocated:		 251.40GiB
    Used:			         211.12GiB
    Free (estimated):		 265.23GiB

The value of 60 can be changed of course. Using 100 will rewrite balance everything, leading to a lot of writes which might be a concern for SSDs.

1 Like

Are you sure the grub menu entries weren’t initiated by timeshift-autosnap during a system update (as described below)?

This was quite a while back, so things could have changed, but my own experiences showed the following:

  1. Timeshift-autosnap creates snapshots on updates and also updates grub automatically, so having grub-btrfs installed creates the snapshot menu entries, BUT …
  2. I couldn’t get grub-btrfs to regenerate grub automatically when a manual snapshot is created. I tried different things to add Timeshifts’s snapshot path to grub-btrfs’s watchpath but didn’t succeed.

My workaround (see #12 & #13 of this Wiki article) is to regenerate the grub.conf automatically at system shutdown. This way the current snapshots are all accessible from the grub boot menu.

2 Likes

Yea rather it’s a autosnap during updates or a manual snap they always show up. I have 4 snaps from today. 2 because of updates and 2 I manually created as test. All 4 show in Timeshift on the desktop, and under the snapshot options during boot.

@AlienProber So if you create a manual snapshot now and then directly reboot, the snapshot will show up in the grub boot menu?

If yes, then please share how you set up grub-btrfs :pray:

All I did was find it in Pamac and installed it. To play it safe I installed timeshift, timeshift-autosnap, rebooted, created my first snapshot then installed grub-btrfs, rebooted and checked it. Nothing more.

EDIT:

I should add I don’t have all the sub volumes that others mention. Just the boot/efi partition and a single unencrypted btrfs partition for the OS.

Well, you at least should have @ and @home as these are a requirement for timeshift to function in btrfs mode, I think.

Run findmnt -t btrfs to check.


In your description the installation of grub-btrfs would initiate a grub-mkconfig called by timeshift-autosnap after creating the snapshot.

So the question if grub-btrfs automatically updates grub if a manual snapshot is added is still not answered … :slightly_smiling_face:


Sorry to ask again, but just to clarify …

Now that you have

  • Timeshift
  • timeshift-autosnap
  • grub-btrfs

installed. When you now …

  1. Create a manual snapshot
    sudo timeshift --create --comments "manual"
  2. and then reboot (without running an update etc. before)
    sudo reboot -n

… the above created snapshot really shows up in the grub menu on this reboot?

Or does it actually only first show up after the next update or package installation on a later reboot?
Which would mean that it’s actually timeshift-autosnap updating grub.This is what happens for me, so I’m really interested in what’s different on your type of setup.

1 Like

This is what I am interested in also. I don’t make auto-snaps only on-demand snapshots.

By the way, have you already tried the instructions I quoted from grub-btrfs’ github page above?

There are some things in there I wonder about:

Is it possible to create a subvolume and direct Timeshift to put its snapshots in there?

If this is possible, how could one mount that subvolume at /.snapshots?

The rest is then enabling and starting the “service”.

–edit–

sudo btrfs subvolume list -p /
shows:

ID 256 gen 4715 parent 5 top level 5 path @
ID 257 gen 4715 parent 5 top level 5 path @home
ID 260 gen 4267 parent 256 top level 256 path var/lib/portables
ID 261 gen 4267 parent 256 top level 256 path var/lib/machines
ID 271 gen 4601 parent 5 top level 5 path timeshift-btrfs/snapshots/2020-09-19_15-49-33/@

Is timeshift-btrfs the subvolume they talk about to be mounted at /.snapshots?

I played around with symlinks, mount-binds and had a look at timeshift and grub-btrfs’s configuration and didn’t get this to work reliably.
Grub-btrfs simply didn’t invoke a grub-mkconfig, hence my workaround.

Yes, that’s what I assumed. Just didn’t work for me.

1 Like

So, we are left with manually running the grub update after each on-demand snapshot?

I haven’t looked at your workaround in Wiki yet (I will) but just to ask: could it be modified to run only when there is a new snapshot and not always at shutdown?

I honestly do not know all the details as should be pretty obvious by my previous post. Please see if you can find someone that actually knows. All I know is what I did as stated above.

With my setup no. As I sated with multiple sub-volumes I could not say one way or the other. I can tell you this now that I think of it, and that is even with minor updates looks like from what I see in Konsole that yes it’s updating Grub.

1 Like

One would think that at worst (!) one could simply script a ‘manual’ Timeshift call that includes a grub update if it doesn’t happen automatically already…

2 Likes