Pete Zaitcev ([info]zaitcev) wrote,
@ 2009-01-19 21:36:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Today, I hate... Alasdair!

There was no update to the long and storied series of hate-by-surprise in a while... but never fear and behold:

[root@niphredil zaitcev]# pvcreate -f /dev/uba4
  Device /dev/uba4 not found (or ignored by filtering).
[root@niphredil zaitcev]# echo usb-storage > \
        /sys/module/libusual/parameters/bias
[root@niphredil zaitcev]# rmmod ehci_hcd && modprobe ehci_hcd
[root@niphredil zaitcev]# pvcreate -f /dev/sdb4
  Physical volume "/dev/sdb4" successfully created
[root@niphredil zaitcev]# 

The anguish and googling occured after the first command, but I'm omitting the depiction of it for brievity. There is no way to disable the mysterious filtering, or even know what is being filtered and why, but fortunately sd was available.

BTW, the output of strace pvcreate is not for the easily scared. The stupid thing invokes stat(2) on every node in /dev.

UPDATE: Commenters en masse pointed me to lvm.conf, which is natural, but... wrong! The message is misleading, my lvm.conf does not filter (Fedora ships with filter = [ "a/.*/" ]). The pvcreate rejects ub because of some built-in filtering.

MORE: Robin comments:

The rest of the commenters here are only partially right in saying that it's got to do with the filters. There is a lot more to the filters than the regular expressions.

1. Your device must show up in sysfs under one of: /sys/subsystem/block/devices, /sys/class/block or /sys/block/. This is controlled by the config option devices/sysfs_scan. (is optional)

2. It should match the regex as defined in config setting devices/filter. (is optional)

3. The major of the device is taken against block devices from /proc/devices, and the name of the type listed in that file MUST appear in the device_info array. This check is NOT optional.

4. It should not be detected as a MD raid component, if config setting devices/md_component_detection is enabled. (is optional)

In this case, ub isn't in the device_info array. Here's a patch, if it works for you, please add your signoff and pass it to agk. http://dev.gentoo.org/~robbat2/lvm2-2.02.42-ub.patch

I changed the number of partitions to 8 in my version of Robin's patch, and everything seems to work now.

LATER: Alasdair e-mailed in reply to Robin's patch submission:

1. You can add entries to lvm.conf without having to recompile. (Look for 'types' in the example conf file).


(10 comments) - (Post a new comment)


[info]sneakums
2009-01-20 06:31 am UTC (link)
pvcreate is probably talking about the filter expressions in lvm.conf's devices section, wherever that lives on your system (/etc/lvm/lvm.conf here).

(Reply to this)


[info]robbat2
2009-01-20 10:41 am UTC (link)
show me:
# grep -w filter /etc/lvm/lvm.conf

I was having weird similar reports in Gentoo, but had non-responsive reporters.

(Reply to this) (Thread)


[info]zaitcev
2009-01-20 07:30 pm UTC (link)
[zaitcev@niphredil ~]$ grep -w filter /etc/lvm/lvm.conf
# A filter that tells LVM2 to only use a restricted set of devices.
# The filter consists of an array of regular expressions. These
# Don't have more than one filter line active at once: only one gets used.
filter = [ "a/.*/" ]
# filter = [ "r|/dev/cdrom|" ]
# filter = [ "a/loop/", "r/.*/" ]
# filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
# filter = [ "a|^/dev/hda8$|", "r/.*/" ]
[zaitcev@niphredil ~]$

Fedora 10 ships without any filtering by default.

Did you see it with ub or some other block device, like ciss?
I suspect that if something is broken with ub only, it's going
to be impossible to get it resolved.

(Reply to this) (Parent)


[info]deviant_
2009-01-20 03:16 pm UTC (link)
The filtering is controlled by /etc/lvm/lvm.conf . I don't particularly /like/ how it works, but you can configure it.

(Reply to this)


[info]robbat2
2009-01-20 08:17 pm UTC (link)
The rest of the commenters here are only partially right in saying that it's got to do with the filters. There is a lot more to the filters than the regular expressions.

1. Your device must show up in sysfs under one of: /sys/subsystem/block/devices, /sys/class/block or /sys/block/. This is controlled by the config option devices/sysfs_scan. (is optional)
2. It should match the regex as defined in config setting devices/filter. (is optional)
3. The major of the device is taken against block devices from /proc/devices, and the name of the type listed in that file MUST appear in the device_info array. This check is NOT optional.
4. It should not be detected as a MD raid component, if config setting devices/md_component_detection is enabled. (is optional)

In this case, ub isn't in the device_info array.
Here's a patch, if it works for you, please add your signoff and pass it to agk.
http://dev.gentoo.org/~robbat2/lvm2-2.02.42-ub.patch

(Reply to this) (Thread)


[info]zaitcev
2009-01-20 10:11 pm UTC (link)
Why do you set the number of partitions to 1? The whole story started because I connected a pre-existing hard drive in a USB case, which must be partitioned (and the example above uses uba4). Or is immaterial?

(Reply to this) (Parent)(Thread)


[info]robbat2
2009-01-20 10:19 pm UTC (link)
Ah, sorry. I mucked that bit up (only thought of UB as a single blob). Patch updated for 16 partitions instead.

md and loop in there should probably get higher numbers too, since partitions are valid in those.

(Reply to this) (Parent)(Thread)


[info]zaitcev
2009-01-20 10:31 pm UTC (link)
I think it has to be 8 or else pvcreate will refuse odd numbered devices (yes it was a big mistake to use 3 bits of minor, sorry).

(Reply to this) (Parent)(Thread)


[info]robbat2
2009-01-20 11:42 pm UTC (link)
Does ub fail if I have more than 8 partitions on a device?
I should test with a GPT on a device at some point as well.

I updated my patch again, I'll send it to agk.

(Reply to this) (Parent)(Thread)


[info]zaitcev
2009-01-21 12:09 am UTC (link)
It depends on your definiton of "fail", I guess. It does not crash, but the extra partitions are not accessible, which I learned the hard way when my TiVo died...
http://zaitcev.livejournal.com/54136.html

(Reply to this) (Parent)


(10 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…