Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi
I would like to add a new SATA disk to my system (CentOS 7.6) by using LVM.
I intend to not use a partition table, and just add the raw device to the LVM. (I do that all the time on CentOS systems)
The block device is visible by the OS, but the LVM is refusing to add it.
The computer is a Intel NUC, and the OS is running from an NVMe SSD.
Code:
# pvcreate /dev/sda
Device /dev/sda excluded by a filter.
# wipefs /dev/sda
# dd if=/dev/zero of=/dev/sda bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000236933 s, 2.2 MB/s
# pvcreate /dev/sda
Device /dev/sda excluded by a filter.
# grep 'filter =' /etc/lvm/lvm.conf | egrep -v '^\s*#'
So I tried to go get a more verbose message from pvcreate and pvscan:
Code:
# pvcreate /dev/sda -vvv
Parsing: pvcreate /dev/sda -vvv
Recognised command pvcreate_general (id 100 / enum 80).
devices/global_filter not found in config: defaulting to global_filter = [ "a|.*/|" ]
Sysfs filter initialised.
Internal filter initialised.
LVM type filter initialised.
Usable device filter initialised.
mpath filter initialised.
Partitioned filter initialised.
MD filter initialised.
Composite filter initialised.
devices/cache not found in config: defaulting to /etc/lvm/cache/.cache
Persistent filter initialised.
metadata/record_lvs_history not found in config: defaulting to 0
DEGRADED MODE. Incomplete RAID LVs will be processed.
Processing command: pvcreate /dev/sda -vvv
Command pid: 24910
System ID:
O_DIRECT will be used
File-based locking selected.
Preparing SELinux context for /run/lock/lvm to system_u:object_r:lvm_lock_t:s0.
Resetting SELinux context to default value.
metadata/pvmetadataignore not found in config: defaulting to 0
metadata/pvmetadatasize not found in config: defaulting to 255
metadata/pvmetadatacopies not found in config: defaulting to 1
report/output_format not found in config: defaulting to basic
log/report_command_log not found in config: defaulting to 0
[...]
devices/cache not found in config: defaulting to /etc/lvm/cache/.cache
Persistent filter initialised.
Finding devices to scan
Creating list of system devices.
Found dev 8:0 /dev/sda - new.
Found dev 8:0 /dev/disk/by-id/ata-ST2000LX001-1RG174_WDZKLS0H - new alias.
Found dev 8:0 /dev/disk/by-id/wwn-0x5000c500c00645df - new alias.
Found dev 8:0 /dev/disk/by-path/pci-0000:00:17.0-ata-3.0 - new alias.
[...]
/dev/sda: size is 3907029168 sectors
Closed /dev/sda
dm version [ opencount flush ] [16384] (*1)
dm status (253:1) [ opencount flush ] [16384] (*1)
/dev/sda: Skipping mpath component device
filter caching bad /dev/sda
dm status (253:0) [ noopencount noflush ] [16384] (*1)
Opened /dev/vg_root/root RO O_DIRECT
[...]
Scanned devices: read errors 0 process errors 0 failed 0
Found VG info for 2 VGs
/dev/sda: filter cache skipping (cached bad)
Processing each PV
Getting list of all devices
/dev/nvme0n1: filter cache using (cached good)
/dev/sda: filter cache skipping (cached bad)
/dev/vg_root/root: filter cache using (cached good)
/dev/nvme0n1p1: filter cache using (cached good)
/dev/mapper/ST2000LX001-1RG174_WDZKLS0H: filter cache using (cached good)
/dev/nvme0n1p2: filter cache using (cached good)
/dev/mapper/ST2000LX001-1RG174_WDZKLS0H1: filter cache using (cached good)
/dev/nvme0n1p3: filter cache using (cached good)
/dev/vg_data_nvme/lv_t1: filter cache using (cached good)
/dev/nvme0n1p4: filter cache using (cached good)
/dev/nvme0n1p5: filter cache using (cached good)
[...]
Completed: pvcreate /dev/sda -vvv
So far, I can see the following messagees standing out:
/dev/sda: Skipping mpath component device
/dev/sda: filter cache skipping (cached bad)
Not sure what to do next.
Any help would be appreciated.
pvcreate is telling you that you need to execute the command on the multipath device, not on /dev/sda which is just one path to the device.
lsblk is telling you that the the multipath device is named ST2000LX001-1RG174_WDZKLS0H (mpath) and the partition is named ST2000LX001-1RG174_WDZKLS0H1 (part).
You can find more info by running "multipath -ll".
pvcreate is telling you that you need to execute the command on the multipath device, not on /dev/sda which is just one path to the device.
lsblk is telling you that the the multipath device is named ST2000LX001-1RG174_WDZKLS0H (mpath) and the partition is named ST2000LX001-1RG174_WDZKLS0H1 (part).
You can find more info by running "multipath -ll".
Yes, I think that's the solution to the problem. - many thanks @smallpond!
I was finally able to create a LVM volume.
However - a word of frustration:
I find the process totally unintuitive.
And the message from pvcreate is unclear about having to use the multipath name instead of the block device name.
I can't see a good reason why pvcreate /dev/sda should not work.
# pvcreate /dev/sda
Device /dev/sda excluded by a filter.
Yeah. That is one of the least informative error messages I've ever seen. The lvm code in general is over-engineered crap. It disguises some fairly straightforward ideas behind overwhelming obscurity. For example, lvm goes out of its way to flag an error if you have a file descriptor open (for logging, for example) when you call one of their commands.
Same problem here, solved by adding the -a flag to the wipefs command.
Code:
# pvcreate /dev/sda
Device /dev/sda excluded by a filter.
# wipefs -a /dev/sda
/dev/sda: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sda: 8 bytes were erased at offset 0x1d1c1115e00 (gpt): 45 46 49 20 50 41 52 54
/dev/sda: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
/dev/sda: calling ioclt to re-read partition table: Success
# pvcreate /dev/sda
Physical volume "/dev/sda" successfully created.
@genese Many thanks for adding this.
I just tried that on a new system.
On my computer, "wipefs -af /dev/sda" did not fix the issue.
I really had to run "pvcreate" against the mpath name.
And this time, the OS is CentOS 8.2.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.