Marios Titas
2012-Jul-25 00:39 UTC
No/bad auto-detection of fs type for small volumes (related to mixed metadata/data?)
When I create a btrfs volume of size strictly less than 256 MiB then if I do mount /dev/sdb1 /mnt/test the kernel tries unsuccessfully to do the mount with many other file systems before successfully trying with btrfs. For volumes of size larger than or equal to 256 MiB it just mounts the volume without doing that. Why is this discrepancy? Another possibly related symptom is that the volume does not appear in /dev/disk/by-label and /dev/disk/by-uuid at all. This means that it is impossible to mount the volume by uuid or label. To make sure that this isn''t a udev bug, I booted my system with init=/bin/bash in the kernel command line, and then I tried again to mount the volume. This time it would not mount it at all unless I explicitly specified the fs type. On the other hand, it could mount larger volumes without any issues. All the experiments were done in an initially zeroed out disk. I am using 3.4.6 kernel with btrfs from 3.5 and the latest btrfs-progs from git. -- 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
Hugo Mills
2012-Jul-25 08:36 UTC
Re: No/bad auto-detection of fs type for small volumes (related to mixed metadata/data?)
On Tue, Jul 24, 2012 at 08:39:36PM -0400, Marios Titas wrote:> When I create a btrfs volume of size strictly less than 256 MiB then if I do > mount /dev/sdb1 /mnt/test > the kernel tries unsuccessfully to do the mount with many other file systems > before successfully trying with btrfs. For volumes of size larger than > or equal to > 256 MiB it just mounts the volume without doing that. Why is this discrepancy?Are you using the --mixed option when creating the filesystem? If not, you should do with something that small. Hugo.> Another possibly related symptom is that the volume does not appear in > /dev/disk/by-label and /dev/disk/by-uuid at all. This means that it is > impossible > to mount the volume by uuid or label. > > To make sure that this isn''t a udev bug, I booted my system with init=/bin/bash > in the kernel command line, and then I tried again to mount the > volume. This time > it would not mount it at all unless I explicitly specified the fs > type. On the other > hand, it could mount larger volumes without any issues. > > All the experiments were done in an initially zeroed out disk. I am > using 3.4.6 kernel > with btrfs from 3.5 and the latest btrfs-progs from git.-- === 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 --- In theory, theory and practice are the same. In --- practice, they''re different.
cwillu
2012-Jul-25 09:09 UTC
Re: No/bad auto-detection of fs type for small volumes (related to mixed metadata/data?)
On Tue, Jul 24, 2012 at 6:39 PM, Marios Titas <redneb8888@gmail.com> wrote:> When I create a btrfs volume of size strictly less than 256 MiB then if I do > mount /dev/sdb1 /mnt/test > the kernel tries unsuccessfully to do the mount with many other file systems > before successfully trying with btrfs. For volumes of size larger than > or equal to > 256 MiB it just mounts the volume without doing that. Why is this discrepancy?If I understand correctly, the kernel does not implement any fs detection; this is performed by the mount utility, which indeed may try a bunch of different filesystems until it finds one that works. From man mount: If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. Mount uses the blkid or volume_id library for guessing the filesystem type; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled "nodev" (e.g., devpts, proc and nfs). If /etc/filesystems ends in a line with a single * only, mount will read /proc/filesystems afterwards. -- 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
Marios Titas
2012-Jul-25 10:37 UTC
Re: No/bad auto-detection of fs type for small volumes (related to mixed metadata/data?)
On Wed, Jul 25, 2012 at 5:09 AM, cwillu <cwillu@cwillu.com> wrote:> On Tue, Jul 24, 2012 at 6:39 PM, Marios Titas <redneb8888@gmail.com> wrote: >> When I create a btrfs volume of size strictly less than 256 MiB then if I do >> mount /dev/sdb1 /mnt/test >> the kernel tries unsuccessfully to do the mount with many other file systems >> before successfully trying with btrfs. For volumes of size larger than >> or equal to >> 256 MiB it just mounts the volume without doing that. Why is this discrepancy? > > If I understand correctly, the kernel does not implement any fs > detection; this is performed by the mount utility, which indeed may > try a bunch of different filesystems until it finds one that works. > > From man mount: > If no -t option is given, or if the auto type is specified, > mount will try to guess the desired type. Mount uses the blkid > or volume_id library for guessing the filesystem type; if that > does not turn up anything that looks familiar, mount will try to > read the file /etc/filesystems, or, if that does not exist, > /proc/filesystems. All of the filesystem types listed there > will be tried, except for those that are labeled "nodev" (e.g., > devpts, proc and nfs). If /etc/filesystems ends in a line with > a single * only, mount will read /proc/filesystems afterwards.Thanks, that was helpful. It was a blkid bug. It was fixed [1] in util-linux 2.21. [1] https://git.kernel.org/?p=utils/util-linux/util-linux.git;a=commit;h=04f7020 -- 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
David Sterba
2012-Jul-26 17:08 UTC
Re: No/bad auto-detection of fs type for small volumes (related to mixed metadata/data?)
On Tue, Jul 24, 2012 at 08:39:36PM -0400, Marios Titas wrote:> When I create a btrfs volume of size strictly less than 256 MiB then if I do > mount /dev/sdb1 /mnt/test > the kernel tries unsuccessfully to do the mount with many other file systems > before successfully trying with btrfs. For volumes of size larger than > or equal to > 256 MiB it just mounts the volume without doing that. Why is this discrepancy?[As Hugo wrote, use --mixed in that case] The underlying reason why it fails is that 256M is a size of some internal structure. If the size is smaller, filesystem will not set up itself, then the mount fails. And mount interprets this as if the filesystem was not there and tries next one. david -- 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