You are not logged in.

#1 2013-10-29 20:56:18

kcy29581
Member
From: CA
Registered: 2004-12-23
Posts: 231

Question about btrfs snapshots and the wiki

Hi all,

I just installed yet another Arch system, and I followed the wiki to get it installed on btrfs. I have a very simple system, with three partitions:
- /dev/sda1, 1MiB- BIOS boot partition (since I have a gpt disk on a BIOS system)
- /dev/sda2, 100GiB - btrfs volume (this will contain multiple distributions in the future as subvolumes, including Arch)
- /dev/sda3, 4GiB - swap partition

So, I installed Arch on a subvolume named archRoot (relevant configs amended to reflect this), and I consulted this page on the wiki: https://wiki.archlinux.org/index.php/Mkinitcpio-btrfs. The part that confuses me is this: https://wiki.archlinux.org/index.php/Mk … the_system; I don't understand why the instructions suggest creating /var/lib/btrfs, and why I'm mounting/binding the archRoot subvolume there, just to make subvolumes. I would've thought the optimal way would be to mount my btrfs volume (/dev/sda2), and snapshot it, so archRoot and its snapshot would both be visible subvolumes under the volume.

Thanks for any help you can give here.


There is no spoon in Arch...

Offline

#2 2013-10-29 22:50:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Question about btrfs snapshots and the wiki

The way I use btrfs is that I make subvols for everything that would have previously been a partition on my non-btrfs system.  So the root of the btrfs filesystem is subvolid=0.  Off that root, I have /rootfs, /home, /pacpkg (pacman cache), /archbuild (devtools chroots), and /snaps.  So in my fstab, each line is almost the same except for the mountpoint and the subvol=.

The problem with that, is that I want to keep my snapshots in /snaps, so in order to give myself access to that, I have to mount subvolid=0 somewhere.  I have chosen to put that as /var/lib/btrfs-root as an autofs (systemd style).  This is not entirely necessary, but for some administrative tasks, it is probably good to give youself easy access to the entire filesystem.

The mkinitpcio-btrfs hook is not at all necessary.  It is a user made tool that seems to be maintained off and on.  It is unfortunate that the wiki seems to indicate that the use of this is the way to use btrfs as your rootfs, as this is really not the case. 

It is also kind of unfortunate that our wiki info on btrfs is pretty incomplete.  I would recommend you go through the man pages in the actual btrfs wiki and get to know some of the awesome features it has to offer.  What really gave me a good idea of how to get going with things was reading some of the articles that are listed half way down the btrfs wiki's main page.  In particular, the articles by Margaret Bierman with Lenz Grimmer gave me a kind of walk through in getting started.  From there I was addicted.  But those articles are a bit old, so the info is still good, but there is so so much more you can do now.

If there were one thing I would recommend that you won't really find info for elsewhere, it would be that you should mount your filesystem with the autodefrag mount option.  Because of the nature of btrfs' CoW, fragmentation is a real possibility, and can seriously hurt the performance of your system.  The autodefrag mount option should be a default mount option at some point, but has not quite made it there yet.  Still it works very well, and I have suffered no problems with it as of yet.

Offline

#3 2013-10-29 22:58:00

kcy29581
Member
From: CA
Registered: 2004-12-23
Posts: 231

Re: Question about btrfs snapshots and the wiki

Thanks for the great info smile

I am used to putting the btrfs volume on /mnt/btrfs. I checked out the wiki you mentioned, but I get the logic behind /var/libs/btrfs now.


There is no spoon in Arch...

Offline

#4 2013-10-29 23:33:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Question about btrfs snapshots and the wiki

Don't use /var/lib/btrfs btw, as that is actually used by btrfs itself... or rather, btrfs-progs I think.  It is where it stores such things as the results from the last scrub.

% ls -l /var/lib/btrfs
total 4.0K
-rw------- 1 root root 817 Oct 28 21:54 scrub.status.f93af0e5-7896-41a8-9190-ac1012ec4d72

Offline

#5 2013-10-29 23:55:03

kcy29581
Member
From: CA
Registered: 2004-12-23
Posts: 231

Re: Question about btrfs snapshots and the wiki

It seems like that wiki needs fixing then. I'd do it myself if I felt confident


There is no spoon in Arch...

Offline

#6 2013-10-30 00:03:24

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Question about btrfs snapshots and the wiki

Do it!  I have faith in you!

Offline

Board footer

Powered by FluxBB