You are not logged in.

#1 2012-07-04 16:38:54

helloworld1
Member
Registered: 2010-12-26
Posts: 60

Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

Seeming GRUB2 (I am using grub 2.0 rc1) supports BTRFS subvolume, but I couldn't find any guide about it.
It takes me almost a day to successfully installed. Most of the time I tried to figure out how deal with grub-install's error "error: grub filesystem doesn't support blocklist". But otherwise, it is pretty straightforward. Run grub-mkconfig and the generated grub.cfg is working.

Last edited by helloworld1 (2012-07-04 16:40:03)

Offline

#2 2012-07-04 20:41:49

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

May I ask, What is your question here?


LENOVO Y 580 IVYBRIDGE 660M NVIDIA
Unix is user-friendly. It just isn't promiscuous about which users it's friendly with. - Steven King

Offline

#3 2012-07-10 09:17:22

extofme
Member
From: here + now
Registered: 2009-10-10
Posts: 174
Website

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

helloworld1 wrote:

Seeming GRUB2 (I am using grub 2.0 rc1) supports BTRFS subvolume, but I couldn't find any guide about it.
It takes me almost a day to successfully installed. Most of the time I tried to figure out how deal with grub-install's error "error: grub filesystem doesn't support blocklist". But otherwise, it is pretty straightforward. Run grub-mkconfig and the generated grub.cfg is working.

yay :-)

you are certain it's in a subvol and not the top-level volume, correct?  i've been thinking about this lately and if what you state is true then -- after several years of false starts and wishful thinking -- i can finally implement kernel-level rollback support in mkinitcpio-btrfs ... hooray!  virtually impossible to bork your system at that point.

the hook has stagnated for a *very* long time while i let the tools mature (reimpl is annoying; time is precious) ... i'll do some testing to verify said claims. thanks!


what am i but an extension of you?

Offline

#4 2012-07-16 05:13:46

helloworld1
Member
Registered: 2010-12-26
Posts: 60

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

extofme wrote:
helloworld1 wrote:

Seeming GRUB2 (I am using grub 2.0 rc1) supports BTRFS subvolume, but I couldn't find any guide about it.
It takes me almost a day to successfully installed. Most of the time I tried to figure out how deal with grub-install's error "error: grub filesystem doesn't support blocklist". But otherwise, it is pretty straightforward. Run grub-mkconfig and the generated grub.cfg is working.

yay :-)

you are certain it's in a subvol and not the top-level volume, correct?  i've been thinking about this lately and if what you state is true then -- after several years of false starts and wishful thinking -- i can finally implement kernel-level rollback support in mkinitcpio-btrfs ... hooray!  virtually impossible to bork your system at that point.

the hook has stagnated for a *very* long time while i let the tools mature (reimpl is annoying; time is precious) ... i'll do some testing to verify said claims. thanks!

Yes, NO top-level volume, the /boot is in the /btrfs-root subvolume. I don't see anyone share successful story in the forum or wiki. So I just post here. I don't have time to write a guide but glad to answer questions and hopefully someone can write a wiki about it.
Here is my mount

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=3983920k,nr_inodes=995980,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
/dev/sda2 on / type btrfs (rw,noatime,ssd,discard,space_cache)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
binfmt on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)

kernel parameters in grub.cfg

        linux   /btrfs-root/boot/vmlinuz-linux root=UUID=9c92ed7c-e128-4b60-a9de-9c8419fe083d ro root
flags=subvol=btrfs-root  quiet add_efi_memmap

If you guys have questions, I am glad to help.

Last edited by helloworld1 (2012-07-16 05:14:44)

Offline

#5 2012-07-16 05:16:13

helloworld1
Member
Registered: 2010-12-26
Posts: 60

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

hadrons123 wrote:

May I ask, What is your question here?

I just want to share this experience because many people are still wonder if the /boot can be in a subvolume in BTRFS.

Offline

#6 2012-07-16 06:12:46

extofme
Member
From: here + now
Registered: 2009-10-10
Posts: 174
Website

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

ok ok that looks promising ... just because i've seen btrfs mount a directory in the past (IIRC internally it just does a -- bind mount), then hose itself soon after, can you please list your subvolumes with:

# btrfs sub list /

... and your /:

# ls -al /

... from within the booted, running system? if that looks correct, i'll be convinced, and will allocate time toward this endeavor :-)


what am i but an extension of you?

Offline

#7 2012-07-16 21:40:30

helloworld1
Member
Registered: 2010-12-26
Posts: 60

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

Here you go.

$ sudo btrfs sub list /                               
ID 256 top level 5 path btrfs-root
ID 260 top level 5 path btrfs-root/home
ID 431 top level 5 path btrfs-root/opt
ID 445 top level 5 path btrfs-root/usr
ID 446 top level 5 path btrfs-root/etc
ID 447 top level 5 path btrfs-root/var
ID 448 top level 5 path btrfs-root/etc-2012-07-05
$ ls -lah                               
total 8.0K
drwxr-xr-x   1 root root  160 Jul 16 14:34 .
drwxr-xr-x   1 root root  160 Jul 16 14:34 ..
drwxr-xr-x   1 root root  520 Jul 16 14:33 bin
drwxr-xr-x   1 root root  128 Jul 16 14:33 boot
drwxr-xr-x  15 root root 2.9K Jul 16 14:22 dev
drwxr-xr-x   1 root root 2.5K Jul 16 14:34 etc
drwxr-xr-x   1 root root 2.4K Jul  5 10:03 etc-2012-07-05
drwxr-xr-x   1 root root   14 Jul  2 19:53 home
lrwxrwxrwx   1 root root    7 Jul  7 03:09 lib -> usr/lib
lrwxrwxrwx   1 root root    7 Jul  7 03:13 lib64 -> usr/lib
drwxr-xr-x   1 root root    0 Jun 20 02:31 media
drwxr-xr-x   1 root root    0 Jun 20 02:31 mnt
drwxr-xr-x   1 root root  850 Jul  3 09:54 opt
dr-xr-xr-x 156 root root    0 Jul 15 19:31 proc
drwxr-x---   1 root root   96 Jul 13 19:10 root
drwxr-xr-x  17 root root  480 Jul 16 14:24 run
drwxr-xr-x   1 root root 2.4K Jul 16 14:34 sbin
drwxr-xr-x   1 root root   14 Jun 20 02:31 srv
dr-xr-xr-x  13 root root    0 Jul 15 19:31 sys
drwxrwxrwt  14 root root  340 Jul 16 14:34 tmp
drwxr-xr-x   1 root root   70 Jul  3 13:00 usr
drwxr-xr-x   1 root root  100 Jul  3 13:05 var
$ df -h                     
Filesystem      Size  Used Avail Use% Mounted on
rootfs          239G  160G   73G  69% /
dev             3.8G     0  3.8G   0% /dev
run             3.9G  348K  3.9G   1% /run
/dev/sda2       239G  160G   73G  69% /
shm             3.9G  136K  3.9G   1% /dev/shm
tmpfs           3.9G   31M  3.8G   1% /tmp
$ cat /etc/fstab 
# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
tmpfs		/tmp	tmpfs	nodev,nosuid	0	0
# DEVICE DETAILS: /dev/sda2 UUID=9c92ed7c-e128-4b60-a9de-9c8419fe083d LABEL=ARCHROOT
UUID=9c92ed7c-e128-4b60-a9de-9c8419fe083d / btrfs defaults,subvol=btrfs-root,ssd,noatime,discard 0 1

Last edited by helloworld1 (2012-07-16 21:41:46)

Offline

#8 2012-07-20 15:55:23

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

Hi
How you dealt with
"error: grub filesystem doesn't support blocklists"
?

Offline

#9 2013-01-03 14:18:51

igoyak
Member
Registered: 2011-08-31
Posts: 3

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

helloworld1, could you outline the steps you took to make it work? Or link to a guide that does?

Offline

#10 2013-01-03 14:34:00

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

igoyak, some time ago I made a guide, maybe it will help you.
Since systemd is now default, some parts of it, especially about the packages to be installed, would not apply, but the btrfs parts should still be valid.

Offline

#11 2013-01-03 21:21:04

igoyak
Member
Registered: 2011-08-31
Posts: 3

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

Thank you aya. I succeeded with your guide in a virtual machine, but not on my laptop, due to other issues.

Offline

#12 2013-01-25 14:00:54

archphil
Member
Registered: 2013-01-25
Posts: 1

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

I installed with three subvolumes, one for root, one for boot and one for home. I mounted boot and home inside the appropriate directories of root. Once made, the installation is the same as the wiki. No need for a special guide. Sorry aya but you made a too complicated one i think.
Maybe the new kernel made it easaier, I worked with kernel 3.7.2 on a virtual machine.
Juste have to leave 1Mo unpartionned at the beginning for grub.
Last thing for me is to find a way to create a swap file on another subvolume and the btrfs would be done.

Offline

#13 2013-01-31 16:17:40

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

archphil, jfyi some long time ago when I had little RAM I created a unit file for systemd to mount a swapfile. It can be done only via loop device in btrfs for as far as I know. It won't be exceptionally fast, but quite workable.

First, you need to create a swap file as usual and format it - in the following case /var/myswaparea/myswapfile. I don't know why you want it in a subvolume, but you certainly can.

[root@myhost ~]# cat /etc/systemd/system/myswap.service 
[Unit]
Description=My custom swapfile via loop device
After=local-fs.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/losetup -f
ExecStart=/sbin/losetup /dev/loop0 /var/myswaparea/myswapfile
ExecStart=/sbin/swapon /dev/loop0
ExecStop=/sbin/swapoff /dev/loop0
ExecStop=/sbin/losetup -d /dev/loop0

[Install]
Alias=local-fs.target.wants/myswap.service

Then you just install this service file as usual in systemd.
This unit file *assumes* /dev/loop0 to be free on boot.

Offline

#14 2013-02-17 17:03:43

thomas.oster
Member
Registered: 2013-02-17
Posts: 2

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

Hi,

please post how you did it. I do not completely understand it yet.

I have my root volume btrfs and the subvolume __active, aswell as the __snapshot directory with subvolume snapshots in between.
For now I also have a /boot directory in the root volume and grub uses that, so I have to copy the current kernel from the __active-volume's boot directory after updates.

As I understand, I now have to install grub in a way, that it will read its config file from __active/boot (which is a directory in the __active subvolume) and
in that config I will refer to the kernel as /__active/boot/vmlinux-linux ?

But if I now want to load a rollback image with a different kernel in it's boot, how does it work?

Offline

#15 2013-02-18 01:10:23

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: Successfully installed arch with BTRFS /boot in a subvolume and GRUB2

Hello,

thomas.oster wrote:

in that config I will refer to the kernel as /__active/boot/vmlinux-linux ?

I guess in the fstab where you would specify a mount option for which subvolume to mount on boot

thomas.oster wrote:

But if I now want to load a rollback image with a different kernel in it's boot, how does it work?

Not quite sure what you mean here. If you snapshotted the subvolume that contains you /boot dir, then you can just specify a different subvolume to boot in fstab and it should work. First try to mount somewhere the subvolume you want to boot into to see what you have in there (you should see the whole tree). And of course have your live CD/USB ready in case you mess up.
You also might want to review the wiki  though it is quite outdated.

Offline

Board footer

Powered by FluxBB