"Invalid argument" when mounting a btrfs raid1 filesystem
Hello,
I'm trying to install current Debian testing (=kernel version 3.2) with btrfs as the root file system. There is also a small ext3 /boot partition.
I create a btrfs raid1 file system with the command
mkfs.btrfs -d raid1 /dev/sda2 /dev/sdb2
Then I can mount it and finish the installation successfully. Booting doesn't work, however: initrd complains that it cannot mount /dev/sda2:
"Invalid argument".
The funny thing is, that in the initrd console I can mount /dev/sdb2! So I changed the kernel parameter in grub.cfg to mount /dev/sdb2 instead, but the problem persists: Now I can mount /dev/sda2 in the initrd console!
In fact, when I boot a rescue system from a thumbdrive, the same thing happens:
# mount -t btrfs /dev/sda2 /mnt mount: mounting /dev/sda2 on /mnt failed: Invalid argument # mount -t btrfs /dev/sdb2 /mnt #
When I keep trying to mount the same device, it keeps failing. When I start mounting /dev/sdb2, it works for /dev/sda2...
Isn't this very weird? Any ideas?
thanks,
Christoph
Christoph Groth wrote (ao):
Quoted 25 lines
I'm trying to install current Debian testing (=kernel version 3.2) with btrfs as the root file system. There is also a small ext3 /boot partition.
I create a btrfs raid1 file system with the command
mkfs.btrfs -d raid1
/dev/sda2/dev/sdb2Then I can mount it and finish the installation successfully. Booting doesn't work, however: initrd complains that it cannot mount
/dev/sda2:
"Invalid argument".The funny thing is, that in the initrd console I can mount
/dev/sdb2! So I changed the kernel parameter in grub.cfg to mount/dev/sdb2instead, but the problem persists: Now I can mount/dev/sda2in the initrd console!In fact, when I boot a rescue system from a thumbdrive, the same thing happens:
# mount -t btrfs /dev/sda2 /mnt mount: mounting /dev/sda2 on /mnt failed: Invalid argument # mount -t btrfs /dev/sdb2 /mnt #
Quoted 4 lines
When I keep trying to mount the same device, it keeps failing. When I start mounting
/dev/sdb2, it works for/dev/sda2...Isn't this very weird? Any ideas?
You might need 'btrfs device scan' before you can mount a multi-device filesystem.
Sander
Signature · 2 lines
Humilis IT Services and Solutions http://www.humilis.net
Quoted 27 lines · Christoph Groth
Hello,
I'm trying to install current Debian testing (=kernel version 3.2) with btrfs as the root file system. There is also a small ext3 /boot partition.
I create a btrfs raid1 file system with the command
mkfs.btrfs -d raid1
/dev/sda2/dev/sdb2Then I can mount it and finish the installation successfully. Booting doesn't work, however: initrd complains that it cannot mount
/dev/sda2:
"Invalid argument".The funny thing is, that in the initrd console I can mount
/dev/sdb2! So I changed the kernel parameter in grub.cfg to mount/dev/sdb2instead, but the problem persists: Now I can mount/dev/sda2in the initrd console!In fact, when I boot a rescue system from a thumbdrive, the same thing happens:
# mount -t btrfs /dev/sda2 /mnt mount: mounting /dev/sda2 on /mnt failed: Invalid argument # mount -t btrfs /dev/sdb2 /mnt #
Quoted 4 lines
When I keep trying to mount the same device, it keeps failing. When I start mounting
/dev/sdb2, it works for/dev/sda2...Isn't this very weird? Any ideas?
As Sadner says, you have to run "btrfs dev scan" before you try to
mount the FS. If you have root on btrfs, this will have to go in an initrd; otherwise, it can go in your initscripts anywhere before the non-root filesystem mounts.
Basically, the kernel needs to know which devices hold which btrfs
filesystems (organised by UUID) before it tries to mount them. So, there's an ioctl that is used for sending that data to the kernel, and a userspace tool (btrfs dev scan) that enumerates all of the block devices it can see, looks for a btrfs superblock on them, and tells the kernel.
Hugo.
Signature · 4 lines
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
--- Have found Lost City of Atlantis. High Priest is ---
winning at quoits. Quoted 9 lines · Hugo Mills <hugo <at> carfax.org.uk> writes:
Basically, the kernel needs to know which devices hold which btrfs
filesystems (organised by UUID) before it tries to mount them. So, there's an ioctl that is used for sending that data to the kernel, and a userspace tool (btrfs dev scan) that enumerates all of the block devices it can see, looks for a btrfs superblock on them, and tells the kernel.Hugo.
If you install the package btrfs-tools (currently dated 5 November 2011 in unstable), it'll set up the necessary.
Quoted 8 lines
Quoted 8 lines
Basically, the kernel needs to know which devices hold which btrfs
filesystems (organised by UUID) before it tries to mount them. So, there's an ioctl that is used for sending that data to the kernel, and a userspace tool (btrfs dev scan) that enumerates all of the block devices it can see, looks for a btrfs superblock on them, and tells the kernel.Hugo.
Thanks for the quick help! I guess that error message ("Invalid argument") could be made more to the point...
Quoted 2 lines · Alex
If you install the package btrfs-tools (currently dated 5 November 2011 in unstable), it'll set up the necessary.
The proper btrfs-tools package was already installed by debian-installer (currently the version in testing is the same as in unstable). Apparently the initrd.img put in place by the installer was not doing what it should. (I'm not sure whether initrd.img is built during installation or whether just some common one is installed.)
I did the following to get a system that boots:
(1) Use the rescue mode of the installation medium to get a shell with /dev/sda2 mounted as root.
(2) Run "update-initramfs -u" to update initrd.img
(3) Run "update-grub" (Not sure whether this was necessary)
(4) Modify /etc/fstab such that the line for the root FS ends with "0 0" and not with "0 1". This is to make the system bootable even when there is no btrfs.fsck.
After a reboot, things started working properly.
Christoph
Quoted 11 lines · Hugo Mills
As Sadner says, you have to run "btrfs dev scan" before you try to
mount the FS. If you have root on btrfs, this will have to go in an initrd; otherwise, it can go in your initscripts anywhere before the non-root filesystem mounts.Basically, the kernel needs to know which devices hold which btrfs
filesystems (organised by UUID) before it tries to mount them. So, there's an ioctl that is used for sending that data to the kernel, and a userspace tool (btrfs dev scan) that enumerates all of the block devices it can see, looks for a btrfs superblock on them, and tells the kernel.
Please, move all this logic to udev rules where we already scans all devices. It's really bad to scan all device more than once. We spent years to fix this problem for LVM, I don't think that btrfs has to repeat the same mistakes.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 13 lines · Karel Zak
Quoted 11 lines · Hugo Mills
As Sadner says, you have to run "btrfs dev scan" before you try to
mount the FS. If you have root on btrfs, this will have to go in an initrd; otherwise, it can go in your initscripts anywhere before the non-root filesystem mounts.Basically, the kernel needs to know which devices hold which btrfs
filesystems (organised by UUID) before it tries to mount them. So, there's an ioctl that is used for sending that data to the kernel, and a userspace tool (btrfs dev scan) that enumerates all of the block devices it can see, looks for a btrfs superblock on them, and tells the kernel.
Quoted 4 lines
Please, move all this logic to udev rules where we already scans all devices. It's really bad to scan all device more than once. We spent years to fix this problem for LVM, I don't think that btrfs has to repeat the same mistakes.
Oh, this is already possible to do with udev rules, quite easily. In fact, dracut ships with the appropriate udev rules, which it uses to initialize btrfs filesystems in the initramfs:
http://git.kernel.org/?p=boot/dracut/dracut.git;a=blob;f=modules.d/90btrfs/80-btrfs.rules;hb=HEAD
which would be suitable with minor modifications for use in a system udev installation as well.
Signature · 1 line
Calvin Walton <[email protected]>
Am Montag, 26. M=C3=A4rz 2012 schrieb Calvin Walton:
Quoted 3 lines · Karel Zak
Quoted 2 lines · Hugo Mills
Quoted 1 line
As Sadner says, you have to run "btrfs dev scan" before you tr=
y
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to
=20
mount the FS. If you have root on btrfs, this will have to go in =
an
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
initrd; otherwise, it can go in your initscripts anywhere before the non-root filesystem mounts.
=20
Basically, the kernel needs to know which devices hold which btrfs
=20
filesystems (organised by UUID) before it tries to mount them. So=
,
Quoted 1 line
Quoted 1 line
Quoted 1 line
there's an ioctl that is used for sending that data to the kernel=
,
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
and a userspace tool (btrfs dev scan) that enumerates all of the block devices it can see, looks for a btrfs superblock on them, and tells the kernel.
=20
Please, move all this logic to udev rules where we already scans a=
ll
Quoted 1 line
Quoted 1 line
devices. It's really bad to scan all device more than once. We spe=
nt
Quoted 8 lines
Quoted 2 lines
years to fix this problem for LVM, I don't think that btrfs has to repeat the same mistakes.
=20
Oh, this is already possible to do with udev rules, quite easily. In fact, dracut ships with the appropriate udev rules, which it uses to initialize btrfs filesystems in the initramfs:
=20
http://git.kernel.org/?p=3Dboot/dracut/dracut.git;a=3Dblob;f=3Dmodule=
s.d/90bt
Quoted 4 lines
rfs/80-btrfs.rules;hb=3DHEAD
=20
which would be suitable with minor modifications for use in a system udev installation as well.
I reported this for Debian long time ago as:
please support raid configurations automatically
http://bugs.debian.org/bug=3D634658
I will be forwarding your mail to the bug report as to suggest this ude= v=20
based solution.
I has also been reported as:
btrfs-tools: add initramfs boot and hook scripts
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D559710
please provide non-initramfs-tools integration
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D585568
Thanks,
--=20
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html