* "Invalid argument" when mounting a btrfs raid1 filesystem @ 2012-03-24 17:40 Christoph Groth 2012-03-24 18:16 ` Sander 2012-03-24 18:21 ` Hugo Mills 0 siblings, 2 replies; 8+ messages in thread From: Christoph Groth @ 2012-03-24 17:40 UTC (permalink / raw) To: linux-btrfs 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-24 17:40 "Invalid argument" when mounting a btrfs raid1 filesystem Christoph Groth @ 2012-03-24 18:16 ` Sander 2012-03-24 18:21 ` Hugo Mills 1 sibling, 0 replies; 8+ messages in thread From: Sander @ 2012-03-24 18:16 UTC (permalink / raw) To: Christoph Groth; +Cc: linux-btrfs Christoph Groth wrote (ao): > 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? You might need 'btrfs device scan' before you can mount a multi-device filesystem. Sander -- Humilis IT Services and Solutions http://www.humilis.net ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-24 17:40 "Invalid argument" when mounting a btrfs raid1 filesystem Christoph Groth 2012-03-24 18:16 ` Sander @ 2012-03-24 18:21 ` Hugo Mills 2012-03-24 18:58 ` Alex 2012-03-26 8:51 ` Karel Zak 1 sibling, 2 replies; 8+ messages in thread From: Hugo Mills @ 2012-03-24 18:21 UTC (permalink / raw) To: Christoph Groth; +Cc: linux-btrfs [-- Attachment #1: Type: text/plain, Size: 2029 bytes --] On Sat, Mar 24, 2012 at 06:40:27PM +0100, Christoph Groth wrote: > 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? 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. -- === 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. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-24 18:21 ` Hugo Mills @ 2012-03-24 18:58 ` Alex 2012-03-24 22:26 ` Christoph Groth 2012-03-26 8:51 ` Karel Zak 1 sibling, 1 reply; 8+ messages in thread From: Alex @ 2012-03-24 18:58 UTC (permalink / raw) To: linux-btrfs 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-24 18:58 ` Alex @ 2012-03-24 22:26 ` Christoph Groth 0 siblings, 0 replies; 8+ messages in thread From: Christoph Groth @ 2012-03-24 22:26 UTC (permalink / raw) To: linux-btrfs >> 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... Alex <alex@bpmit.com> writes: > 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-24 18:21 ` Hugo Mills 2012-03-24 18:58 ` Alex @ 2012-03-26 8:51 ` Karel Zak 2012-03-26 15:00 ` Calvin Walton 1 sibling, 1 reply; 8+ messages in thread From: Karel Zak @ 2012-03-26 8:51 UTC (permalink / raw) To: Hugo Mills, Christoph Groth, linux-btrfs On Sat, Mar 24, 2012 at 06:21:05PM +0000, Hugo Mills wrote: > 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 -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-26 8:51 ` Karel Zak @ 2012-03-26 15:00 ` Calvin Walton 2012-04-09 11:58 ` Martin Steigerwald 0 siblings, 1 reply; 8+ messages in thread From: Calvin Walton @ 2012-03-26 15:00 UTC (permalink / raw) To: Karel Zak; +Cc: Hugo Mills, Christoph Groth, linux-btrfs On Mon, 2012-03-26 at 10:51 +0200, Karel Zak wrote: > On Sat, Mar 24, 2012 at 06:21:05PM +0000, Hugo Mills wrote: > > 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. 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. -- Calvin Walton <calvin.walton@kepstin.ca> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "Invalid argument" when mounting a btrfs raid1 filesystem 2012-03-26 15:00 ` Calvin Walton @ 2012-04-09 11:58 ` Martin Steigerwald 0 siblings, 0 replies; 8+ messages in thread From: Martin Steigerwald @ 2012-04-09 11:58 UTC (permalink / raw) To: linux-btrfs; +Cc: Calvin Walton, Karel Zak, Hugo Mills, Christoph Groth Am Montag, 26. M=C3=A4rz 2012 schrieb Calvin Walton: > On Mon, 2012-03-26 at 10:51 +0200, Karel Zak wrote: > > On Sat, Mar 24, 2012 at 06:21:05PM +0000, Hugo Mills wrote: > > > As Sadner says, you have to run "btrfs dev scan" before you tr= y > > > to > > >=20 > > > 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. > > >=20 > > > Basically, the kernel needs to know which devices hold which > > > btrfs > > >=20 > > > 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. > > =20 > > Please, move all this logic to udev rules where we already scans a= ll > > devices. It's really bad to scan all device more than once. We spe= nt > > 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 > 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-04-09 11:58 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-24 17:40 "Invalid argument" when mounting a btrfs raid1 filesystem Christoph Groth 2012-03-24 18:16 ` Sander 2012-03-24 18:21 ` Hugo Mills 2012-03-24 18:58 ` Alex 2012-03-24 22:26 ` Christoph Groth 2012-03-26 8:51 ` Karel Zak 2012-03-26 15:00 ` Calvin Walton 2012-04-09 11:58 ` Martin Steigerwald
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox