Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
btrfs mounts only @ subvol, won't mount other sv [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Wed Apr 06, 2016 9:28 am    Post subject: btrfs mounts only @ subvol, won't mount other sv [solved] Reply with quote

Renamed from "btrfs + dracut + systemd not mounting root volume and subvolumes" to reflect what the problem is

Hi all,

I ventured into the brave new world of btrfs + dracut + systemd on Gentoo (clean install), but the thing is, systemd fails to mount my btrfs partition/subvolumes. After looking everywhere, I'm not smarter so here my plea for help (beware: using systemd and btrfs for the first time, so I may be ignorant to the obvious).

So, this is the screenshot of the first-boot screen (is there a more sane way to debug systemd's boot if I'm not able to get into the shell?). The following retreived when booting again from minimal iso and chrooting into the environment.


ls -ahl /boot # http://pastebin.ca/raw/3453232
cat /usr/src/linux/.config # http://pastebin.ca/raw/3453247
cat /etc/dracut.conf.d/local.conf # http://pastebin.ca/raw/3453249
cat /etc/fstab # http://pastebin.ca/raw/3453255
btrfs subvolume list / # http://pastebin.ca/raw/3453260
cat /boot/grub/grub.cfg # http://pastebin.ca/raw/3453266
fdisk -l # http://pastebin.ca/raw/3453272


Any ideas? Thanks in advance
_________________
Senbonzakura


Last edited by pavel.stratil on Sun May 01, 2016 7:47 pm; edited 3 times in total
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1746

PostPosted: Wed Apr 06, 2016 8:05 pm    Post subject: Reply with quote

While hanging around in #btrfs, I've seen a few systemd+btrfs users who've had a weird problem where systemd just decides to unmount / as soon as it's mounted.

I'm not sure if they were able to sort out the problem tho'.
Back to top
View user's profile Send private message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Fri Apr 08, 2016 1:26 pm    Post subject: Reply with quote

Cyker, thanks for the tip. I thing my btrfs wont mout at all, so proly a different problem?

Adding some more info. First, here a retrace of how I setup the system:

Code:

# Partitioning
parted -a optimal /dev/sda mklabel gpt 
sgdisk -o /dev/sda
FS=`sgdisk -F ${1}` ; sgdisk -n 1:${FS}:8M -c 1:"biosboot" -t 1:ef02 /dev/sda
FS=`sgdisk -F ${1}` ; sgdisk -n 2:${FS}:500M -c 2:"boot" -t 2:8300 /dev/sda
FS=`sgdisk -F ${1}` ; sgdisk -n 3:${FS}:12G -c 3:"swap" -t 3:8200 /dev/sda
FS=`sgdisk -F ${1}` ;
ES=`sgdisk -E ${1}` ; sgdisk -n 4:${FS}:${ES} -c 4:"btrfs" -t 4:8300 /dev/sda

# Filesystems
mkfs.btrfs -f -L "btrfs" /dev/sda4
mkfs.ext4 -L "boot" /dev/sda2
mkswap -L "swap" /dev/sda3
swapon /dev/sda3

# Creating subvolumes
mkdir -p /mnt/btrfs
mount -t btrfs -o defaults,noatime,compress=lzo,autodefrag /dev/sda4 /mnt/btrfs
pushd /mnt/btrfs
btrfs subvolume create @
btrfs subvolume create @/tmp
btrfs subvolume create @/var
btrfs subvolume create @/var/log
btrfs subvolume create @/root
btrfs subvolume create @/home
btrfs subvolume create PORTAGE
popd
umount /mnt/btrfs 


here also my /etc/default/grub http://pastebin.ca/raw/3461964

after adding systemd.confirm_spawn=true to the parameteres in grub and interactive booting on systemd, did some more screenshots of the boot process

https://www.dropbox.com/s/36j2jtfzk8jjzu8/IMG_20160408_170703.jpg?dl=0 ... ok, kernel can see /dev/sda
https://www.dropbox.com/s/r49ds0jfgb9zmlt/IMG_20160408_170710.jpg?dl=0 ... nothing really interesting here i guess
https://www.dropbox.com/s/ph42b5ejsabn7ew/IMG_20160408_170756.jpg?dl=0 ... systemd fingures out it should do sthing about the root. systemd additionally starts fsck on background
https://www.dropbox.com/s/e1mzs4hhnj77m87/IMG_20160408_171407.jpg?dl=0 ... continuing aaand
https://www.dropbox.com/s/jnc6ayrb8hzk2pc/IMG_20160408_171717.jpg?dl=0 ... nope

any ideas?
_________________
Senbonzakura
Back to top
View user's profile Send private message
davidm
Guru
Guru


Joined: 26 Apr 2009
Posts: 557
Location: US

PostPosted: Thu Apr 14, 2016 2:19 pm    Post subject: Reply with quote

For starters the first thing I notice in your /etc/fstab:

Code:

# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/BOOT      /boot      ext2      noauto,noatime   1 2
/dev/ROOT      /      ext3      noatime      0 1
/dev/SWAP      none      swap      sw      0 0
/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0
/dev/fd0      /mnt/floppy   auto      noauto      0 0

# <fs>              <mountpoint>    <type>      <opts>                                                                         <dump/pass>
LABEL=boot        /boot           ext4        noauto,noatime                                                                  1 2
LABEL=btrfs       /               brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,subvol=@                   0 0
LABEL=btrfs       /tmp            brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,nodatacow,subvol=@/tmp     0 0
LABEL=btrfs       /var            brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,subvol=@/var               0 0
LABEL=btrfs       /root           brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,subvol=@/root              0 0
LABEL=btrfs       /home           brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,subvol=@/home              0 0

LABEL=btrfs       /var/log        brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,nodatacow,subvol=@/var/log 0 0
LABEL=btrfs       /usr/portage    brtfs       defaults,space_cache,noatime,compress=lzo,autodefrag,nodatacow,subvol=PORTAGE   0 0
LABEL=swap        none            swap        sw                                                                              0 0


Shouldn't most of these be commented out like so?

Code:

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#/dev/BOOT      /boot      ext2      noauto,noatime   1 2
#/dev/ROOT      /      ext3      noatime      0 1
#/dev/SWAP      none      swap      sw      0 0
/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0
#/dev/fd0      /mnt/floppy   auto      noauto      0 0


It's probable that systemd is getting very confused by this and it is no wonder it isn't working.
Back to top
View user's profile Send private message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Tue Apr 19, 2016 7:24 pm    Post subject: Reply with quote

Hi all, sorry for the delayed reply. Wow, I didnt even notice the duplicate fstab entries 8O ... nontheless, correcting the fstab didn't help. BTRFS still wont mount (see https://www.dropbox.com/s/simfsa6cost3fvh/IMG_20160419_195245.jpg?dl=0) ...
_________________
Senbonzakura
Back to top
View user's profile Send private message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Sat Apr 23, 2016 7:09 pm    Post subject: Reply with quote

Hi all, so, I finally managed to boot into a cripled system and see now where the problem is, notheless, dont know what to do about it. What I did was the following:

1. simplified subvolumes to have only
- @ subvolume mounted to /
- @home subvolume mounted to /home

the number of errors reduced, but the problem remained.

2. I commented out in /etc/fstab mounting of the @home subvolume, thus mounting only
- /boot partition (ext4)
- btrfs partition, subvol=@ onto /
- swap

and the system booted! so obviously, there's something terribly wrong about the subvolumes below @, because they just won't mount. Will post more details.
_________________
Senbonzakura
Back to top
View user's profile Send private message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Tue Apr 26, 2016 10:13 pm    Post subject: Reply with quote

OK, so first I had a look into the initramfs with lsinitrd /boot/initramfs-4.4.6-gentoo.img | grep btrfs: http://pastebin.ca/raw/3584139.
I also browsed the files, since I've been using the xz compression, I did:

Code:

mkdir -p /root/initram
cd /root/initram
cp /boot/initramfs-4.4.6-gentoo.img ./init.xz
unfoo ./init.xz # emerge unfoo for the hot stuff
cat ./init | cpio -id


and found nothing interesting. Since I now can boot the system, I could finally do

systemctl status home.mount http://pastebin.ca/raw/3584138 to finally find:

Code:
mount[3000]: mount unknown filesystem type 'btrfs'


which is really weird, because the @ subvolume mounted to / just right, but the nested @home to be mounted at /home doesnt. Ugh. Any ideas?
_________________
Senbonzakura
Back to top
View user's profile Send private message
cal22cal
n00b
n00b


Joined: 19 Jan 2006
Posts: 36

PostPosted: Wed Apr 27, 2016 10:41 am    Post subject: Reply with quote

I am not sure about the followings, though.

What you had done
Code:
# Creating subvolumes
mkdir -p /mnt/btrfs
mount -t btrfs -o defaults,noatime,compress=lzo,autodefrag /dev/sda4 /mnt/btrfs
pushd /mnt/btrfs
btrfs subvolume create @
btrfs subvolume create @/tmp
btrfs subvolume create @/var
btrfs subvolume create @/var/log
btrfs subvolume create @/root
btrfs subvolume create @/home
btrfs subvolume create PORTAGE
popd
umount /mnt/btrfs 

"@" and "PORTAGE" were directly under the subvolid=0
btrfs will automatically see those sub-volumes, therefore, after mounting the "@" as /
all the sub-volume under it can be accessed.
Howerver, fstab should have an entry for PORTAGE something like
Code:
LABEL=XXXX  /usr/portage                btrfs  rw,noatime,compress=lzo,autodefrag,subvol=PORTAGE 0 0

Take a look for
http://www.funtoo.org/BTRFS_Fun
Code:
Changing the point of view on the subvolumes hierarchy

might have some hints.
Back to top
View user's profile Send private message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Fri Apr 29, 2016 8:10 pm    Post subject: Reply with quote

Hey cal22cal, thanks for the tips. I'm not sure I understand what you're pointing out, but I'll still try to comment/explain - maybe there's something wrong in what I do:

- I added the whole subvolume hierarchy to the fstab to use different mount options with different subvols, not for the reason of mounting the subvols
- I created a test partitioning with only @ and @home (both directly under subvol=0). Here mounting of @ succeeded, but mountng @home did not, with systemd complaining about an unknown filesystem (see http://pastebin.ca/raw/3584138).

would you point out where exactly i might be doing a mistake?
_________________
Senbonzakura
Back to top
View user's profile Send private message
cal22cal
n00b
n00b


Joined: 19 Jan 2006
Posts: 36

PostPosted: Sat Apr 30, 2016 4:51 am    Post subject: Reply with quote

pavel.stratil,
Sorry, not a native English speaker here. ;)
What I understood is :-
this line
Code:
btrfs subvolume create @/home

You have created a subvolume under the @ subvolume, i.e. not directly under subvolid=0

After booting up your system, command
Code:
btrfs subvolume list -pat /

Something similar
Code:
ID   gen   parent   top level   path   
--   ---   ------   ---------   ----   
257   118   5   5      <FS_TREE>/@
258   100   5   5      <FS_TREE>/PORTAGE
265   126   257   5      <FS_TREE>/@/under@_A
266   127   257   5      <FS_TREE>/@/under@_B
267   128   257   5      <FS_TREE>/@/under@_C
268   129   257   5      <FS_TREE>/@/under@_D
269   130   257   5      <FS_TREE>/@/under@_E

If the parent was 5, you needed to put an entry in fstab
and mkdir home under the @ subvol for boot mount.

This command should be used when you create the home subvol.
Code:
btrfs subvolume create home


just like the PORTAGE subvol

Code:
btrfs subvolume list -pat /
ID   gen   parent   top level   path   
--   ---   ------   ---------   ----   
257   118   5   5      <FS_TREE>/@
258   100   5   5      <FS_TREE>/home
....

In short, check the parent id.
If the parent had mount, all the subvol underneath can be accessed from the mount point.
Wish no typo, though :wink:
Back to top
View user's profile Send private message
cal22cal
n00b
n00b


Joined: 19 Jan 2006
Posts: 36

PostPosted: Sat Apr 30, 2016 9:56 am    Post subject: Reply with quote

I am sorry, never used pastbin before.
For better understanding, append some output
Code:
root@ub-md-lvm:~# uname -a
Linux ub-md-lvm 4.2.0-27-generic #32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Code:

root@ub-md-lvm:~# btrfs subvolume list -pat /
ID      gen     parent  top level       path   
--      ---     ------  ---------       ----   
257     234     5       5               <FS_TREE>/@
258     228     5       5               <FS_TREE>/@home
261     204     258     5               <FS_TREE>/@home/subvol_under_@home
263     210     257     5               <FS_TREE>/@/@home

Can't create the @/home subvol since my /home directory (not subvol) already existed.
Code:
root@ub-md-lvm:~# cat /etc/fstab
UUID=6c85a86a-8d0a-457a-bfd8-3f7d63034882 /boot   ext2    defaults   0  2

/dev/mapper/vg-lg /             btrfs   defaults,subvol=@       0  1
/dev/mapper/vg-lg /home         btrfs   defaults,subvol=@home   0  2  # Prefered
/dev/mapper/vg-lg /home_under_@ btrfs   defaults,subvol=@/@home 0  2  # Don't want this

/dev/mapper/vg-lg /mnt/TOP      btrfs   defaults,subvolid=0     0  2

Code:
root@ub-md-lvm:~# mount | grep btrfs 
/dev/mapper/vg-lg on / type btrfs (rw,subvol=@)
/dev/mapper/vg-lg on /home type btrfs (rw,subvol=@home)
/dev/mapper/vg-lg on /home_under_@ type btrfs (rw,subvol=@/@home)
/dev/mapper/vg-lg on /mnt/TOP type btrfs (rw,subvolid=0)
Back to top
View user's profile Send private message
pavel.stratil
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2005
Posts: 134

PostPosted: Sun May 01, 2016 7:46 pm    Post subject: Reply with quote

Thanks a lot! after playing with this for hours i finally found the problem. My fstab had brtfs instead of btrfs ... a typo i've missed even when checking like 10 times. sorry everyone and thanks for all the guidance, i feel a bit more confident about using btrfs now.
_________________
Senbonzakura
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum