Skip to contentSkip to conversation

pvcreate fails on a software RAID metadisk

linux-lvm Bill Ellis 4 participants 7 messages Oct 4, 2001 – Oct 5, 2001 Library code

lore
Share & tools
lore

Bill Ellis

author
#0 lore raw

Hi,

I'm trying to set up lvm 1.01rc4 under a 2.4.10 kernel. I'm getting an error when I try to use pvcreate on a software RAID metadisk. From the '-v' output of pvcreate, it appears that pvcreate thinks my metadisk is zero-length.

Here's an example:

root@tik-tok:~# pvcreate /dev/md7
pvcreate -- ERROR "parameter error" setting up  physical volume "/dev/md7"
root@tik-tok:~# pvcreate -v /dev/md7
pvcreate -- locking logical volume manager
pvcreate -- checking physical volume name "/dev/md7"
pvcreate -- getting physical volume size
pvcreate -- checking partition type
pvcreate -- creating new physical volume
pvcreate -- setting up physical volume for /dev/md7 with 0 sectors
pvcreate -- ERROR "parameter error" setting up  physical volume "/dev/md7"
root@tik-tok:~# pvcreate --version
pvcreate: Logical Volume Manager 1.0.1-rc4
Heinz Mauelshagen, Sistina Software  03/10/2001 (IOP 10)
root@tik-tok:~# cat /proc/mdstat | grep -A2 md7
md7 : active raid5 sde7[4] sdd7[3] sdc7[2] sdb7[1] sda7[0]
      24575488 blocks level 5, 128k chunk, algorithm 0 [5/5] [UUUUU]
root@tik-tok:~# grep md7 /proc/partitions
   9     7   24575488 md7

Any tips on what might be going on here would be appreciated...

Thanks,
Bill Ellis

author
#1 lore raw

Hi again,

Some more playing around led me to discover that 'lvmdiskscan' is also not recognizing my software RAID metadisks correctly. Here's what I think are the relevant portions of the ~5600 lines of output from the 'lvmdiskscan -d -v' command:

<1> lvm_dir_cache -- CALLED
<22> lvm_add_dir_cache -- CALLED with /dev/md3
...
<22> lvm_add_dir_cache -- CALLED with /dev/md7
<333> lvm_check_dev -- CALLED
<4444> lvm_check_partitioned_dev -- CALLED
<55555> lvm_get_device_type called
<55555> lvm_get_device_type leaving with 2
<4444> lvm_check_partitioned_dev -- LEAVING with ret: TRUE <333> lvm_check_dev -- LEAVING with ret: 1
<22> lvm_add_dir_cache -- LEAVING with ret: ADDED
...
<1> pv_get_size -- CALLED with /dev/md7 and 0xbffff8ac
<22> lvm_dir_cache -- CALLED
<22> lvm_dir_cache -- LEAVING with ret: 50
<22> lvm_dir_cache_find -- CALLED with /dev/md7
<333> pv_check_name -- CALLED with "/dev/md7"
<4444> lvm_check_chars -- CALLED with name: "/dev/md7" <4444> lvm_check_chars -- LEAVING with ret: 0
<4444> lvm_check_dev -- CALLED
<55555> lvm_check_partitioned_dev -- CALLED
<666666> lvm_get_device_type called
<666666> lvm_get_device_type leaving with 2
<55555> lvm_check_partitioned_dev -- LEAVING with ret: TRUE <4444> lvm_check_dev -- LEAVING with ret: 1
<333> pv_check_name -- LEAVING with ret: 0
<333> lvm_dir_cache -- CALLED
<333> lvm_dir_cache -- LEAVING with ret: 50
<22> lvm_dir_cache_find -- LEAVING with entry: 4
<22> lvm_check_partitioned_dev -- CALLED
<333> lvm_get_device_type called
<333> lvm_get_device_type leaving with 2
<22> lvm_check_partitioned_dev -- LEAVING with ret: TRUE <22> lvm_partition_count -- CALLED for 0x907
<333> lvm_get_device_type called
<333> lvm_get_device_type leaving with 2
<22> lvm_partition_count -- LEAVING with ret: 16
<1> pv_get_size -- LEAVING with ret: 0
...
lvmdiskscan -- reading all disks / partitions (this may take a while...) lvmdiskscan -- filling directory cache...
lvmdiskscan -- walking through all found disks / partitions

lvmdiskscan -- /dev/md3  [             0] Primary   [0x07]
lvmdiskscan -- /dev/md4  [             0] Primary   [0x07]
lvmdiskscan -- /dev/md5  [             0] Extended  [0x07]
lvmdiskscan -- /dev/md6  [             0] Extended  [0x07]
lvmdiskscan -- /dev/md7  [             0] Extended  [0x07]

lvmdiskscan -- /dev/sda1 [ 19.98 MB] Primary LINUX native partition
[0x83]
lvmdiskscan -- /dev/sda2 [ 80.00 MB] Primary LINUX swap partition [0x82]

lvmdiskscan -- /dev/sda3 [ 5.76 GB] Primary [0xFD]
lvmdiskscan -- /dev/sda4 [ 28.34 GB] DOS extended partition [0x05]

lvmdiskscan -- /dev/sda5 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sda6 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sda7 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sda8 [       5.86 GB] Extended LVM partition [0x8E]

lvmdiskscan -- /dev/sdb1 [ 19.98 MB] Primary LINUX native partition
[0x83]
lvmdiskscan -- /dev/sdb2 [ 80.00 MB] Primary LINUX swap partition [0x82]

lvmdiskscan -- /dev/sdb3 [ 5.76 GB] Primary [0xFD]
lvmdiskscan -- /dev/sdb4 [ 28.34 GB] DOS extended partition [0x05]

lvmdiskscan -- /dev/sdb5 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdb6 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdb7 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdb8 [       5.86 GB] Extended LVM partition [0x8E]

lvmdiskscan -- /dev/sdc1 [ 19.98 MB] Primary LINUX native partition
[0x83]
lvmdiskscan -- /dev/sdc2 [ 80.00 MB] Primary LINUX swap partition [0x82]

lvmdiskscan -- /dev/sdc3 [ 5.76 GB] Primary [0xFD]
lvmdiskscan -- /dev/sdc4 [ 28.34 GB] DOS extended partition [0x05]

lvmdiskscan -- /dev/sdc5 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdc6 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdc7 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdc8 [       5.86 GB] Extended LINUX native partition

[0x83]
lvmdiskscan -- /dev/sdd1 [ 19.98 MB] Primary LINUX native partition
[0x83]
lvmdiskscan -- /dev/sdd2 [ 80.00 MB] Primary LINUX swap partition [0x82]

lvmdiskscan -- /dev/sdd3 [ 5.76 GB] Primary [0xFD]
lvmdiskscan -- /dev/sdd4 [ 28.34 GB] DOS extended partition [0x05]

lvmdiskscan -- /dev/sdd5 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdd6 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdd7 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sdd8 [       5.86 GB] Extended LINUX native partition

[0x83]
lvmdiskscan -- /dev/sde1 [ 19.98 MB] Primary LINUX native partition
[0x83]
lvmdiskscan -- /dev/sde2 [ 80.00 MB] Primary LINUX swap partition [0x82]

lvmdiskscan -- /dev/sde3 [ 5.76 GB] Primary LINUX native partition
[0x83]
lvmdiskscan -- /dev/sde4 [ 28.34 GB] DOS extended partition [0x05]

lvmdiskscan -- /dev/sde5 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sde6 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sde7 [       5.86 GB] Extended  [0xFD]
lvmdiskscan -- /dev/sde8 [       5.86 GB] Extended LINUX native partition

[0x83]
lvmdiskscan -- 5 disks
lvmdiskscan -- 0 whole disks
lvmdiskscan -- 0 loop devices
lvmdiskscan -- 0 multiple devices
lvmdiskscan -- 0 network block devices
lvmdiskscan -- 45 partitions
lvmdiskscan -- 2 LVM physical volume partitions

Again, if anyone can give me any leads as to what might be going wrong here, I'd appreciate it. Also, if there is any more information I can provide on this matter, just let me know...

Thanks,
Bill

#2 lore raw
Quoted 5 lines · Bill Ellis

Some more playing around led me to discover that 'lvmdiskscan' is also not recognizing my software RAID metadisks correctly. Here's what I think are the relevant portions of the ~5600 lines of output from the 'lvmdiskscan -d -v' command:

Quoted 9 lines

<22> lvm_dir_cache_find -- CALLED with /dev/md7 <333> pv_check_name -- CALLED with "/dev/md7" <4444> lvm_check_chars -- CALLED with name: "/dev/md7" <4444> lvm_check_chars -- LEAVING with ret: 0 <4444> lvm_check_dev -- CALLED
<55555> lvm_check_partitioned_dev -- CALLED <666666> lvm_get_device_type called
<666666> lvm_get_device_type leaving with 2 <55555> lvm_check_partitioned_dev -- LEAVING with ret: TRUE

This is a problem - MD devices are not partitioned. Have a look at this function to see why it thinks so.

Quoted 10 lines

<4444> lvm_check_dev -- LEAVING with ret: 1
<333> pv_check_name -- LEAVING with ret: 0
<333> lvm_dir_cache -- CALLED
<333> lvm_dir_cache -- LEAVING with ret: 50
<22> lvm_dir_cache_find -- LEAVING with entry: 4

<22> lvm_check_partitioned_dev -- CALLED
<333> lvm_get_device_type called
<333> lvm_get_device_type leaving with 2
<22> lvm_check_partitioned_dev -- LEAVING with ret: TRUE

A pet peeve of mine - we shouldn't have to call this function twice (probably we should assume that anything that is in the dir cache is a valid device (and check devices one time when they are added)).

Quoted 4 lines

<22> lvm_partition_count -- CALLED for 0x907
<333> lvm_get_device_type called
<333> lvm_get_device_type leaving with 2
<22> lvm_partition_count -- LEAVING with ret: 16

I suspect this is just an artifact of the code thinking it is a partitioned device.

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert

#3 lore raw
Quoted 5 lines · Andreas Dilger
Quoted 1 line · Bill Ellis

<55555> lvm_check_partitioned_dev -- LEAVING with ret: TRUE

This is a problem - MD devices are not partitioned. Have a look at this function to see why it thinks so.

no this should be normal
i believe the problem lies somewhere else in the damned cache i tested it on one of my systems, i have 4 disks and 4 md devices there md/0 is not detected
md/1 to md/3 are
and lvmdiskscan says i have 5 disks and 3 md devices.

look in http://www.comedia.it/bluca/lvm/
you will find lvmdiskscan output for
md0 (not working)
md1 (working)
and a diff file between the two that may help debugging basically pv_read is called for md/1 and not for md/0

(i was using current cvs)

i will look further into this problem since i have to build a new lvm over md but if someone else looks in it the better.

L.

Signature · 6 lines
Luca Berra -- [email protected]
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \
#4 lore raw
Quoted 4 lines · Luca Berra
Quoted 3 lines · Andreas Dilger
Quoted 1 line · Bill Ellis

<55555> lvm_check_partitioned_dev -- LEAVING with ret: TRUE

Quoted 8 lines
Quoted 2 lines

This is a problem - MD devices are not partitioned. Have a look at this function to see why it thinks so.

no this should be normal
i believe the problem lies somewhere else in the damned cache i tested it on one of my systems, i have 4 disks and 4 md devices there md/0 is not detected
md/1 to md/3 are

Well, a quick look into lvm_check_partitioned_dev.c makes me think the whole thing is broken. lvm_check_partitioned_dev() is only checking if this is a block device (via lvm_get_device_type()). If you look at pv_get_size(), it is depending on this to return FALSE if it is not a partitioned device type (which it never does now).

Running "cvs annotate tools/lib/lvm_check_partitioned_dev.c" shows that "akergon" is in the hot seat now (having re-written 90% of this file). What is probably needed is to move the unpartitioned devices code out from lvm_check_dev() into another helper function, which can be called from lvm_check_dev(), lvm_check_partitioned_dev(), lvm_partition_count(), and lvm_check_whole_disk_dev().

Then lvm_check_partitioned_dev() can return FALSE if it is a whole disk device, lvm_check_whole_disk_dev() will return TRUE, lvm_partition_count() should probably return 1 for a whole disk device.

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert

#5 lore raw
In reply to Bill Ellis

I experienced something similar with 1.0.1-rc2 (see the [linux-lvm] Root + Software RAID 1 in partition + LVM + Reiserfs) thread.
From the code in pv_check_partitioned_dev it seems to me you run into exactly the same problem.

I did a quick and dirty patch which fixed it for me.
Please be aware: I am new to this list, new to linux LVM...
I know the patch will prevent you from using any partitioned MD device in LVM. I have no idea of further implications.
------------------------------------------------------------
diff -ru 1.0.1-rc2/tools/lib/lvm_check_partitioned_dev.c slp-1.0.1-rc2/tools/lib/lvm_check_partitioned_dev.c
--- 1.0.1-rc2/tools/lib/lvm_check_partitioned_dev.c Mon Aug 20 17:17:56 2001
+++ slp-1.0.1-rc2/tools/lib/lvm_check_partitioned_dev.c Thu Oct 4 14:47:37
2001
@@ -55,6 +55,8 @@
switch (lvm_get_device_type(st_rdev)) {
case LVM_DEVICE_TYPE_INVALID:
break;
+ case 2: /* YAL: MD device on partition. Won't partition it. */
+ break;
default:
ret = TRUE;
}
------------------------------------------------------------

Please wait until more experienced people comment this patch before using it.

Yves

Quoted 52 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Bill Ellis
Sent: Thursday, October 04, 2001 6:16 PM
To: [email protected]
Subject: [linux-lvm] pvcreate fails on a software RAID metadisk

Hi,

I'm trying to set up lvm 1.01rc4 under a 2.4.10 kernel. I'm getting an error when I try to use pvcreate on a software RAID metadisk. From the '-v' output of pvcreate, it appears that pvcreate thinks my metadisk is zero-length.

Here's an example:

root@tik-tok:~# pvcreate /dev/md7
pvcreate -- ERROR "parameter error" setting up  physical volume "/dev/md7"
root@tik-tok:~# pvcreate -v /dev/md7
pvcreate -- locking logical volume manager
pvcreate -- checking physical volume name "/dev/md7"
pvcreate -- getting physical volume size
pvcreate -- checking partition type
pvcreate -- creating new physical volume
pvcreate -- setting up physical volume for /dev/md7 with 0 sectors
pvcreate -- ERROR "parameter error" setting up  physical volume "/dev/md7"
root@tik-tok:~# pvcreate --version
pvcreate: Logical Volume Manager 1.0.1-rc4
Heinz Mauelshagen, Sistina Software  03/10/2001 (IOP 10)
root@tik-tok:~# cat /proc/mdstat | grep -A2 md7
md7 : active raid5 sde7[4] sdd7[3] sdc7[2] sdb7[1] sda7[0]
      24575488 blocks level 5, 128k chunk, algorithm 0 [5/5] [UUUUU]
root@tik-tok:~# grep md7 /proc/partitions
   9     7   24575488 md7

Any tips on what might be going on here would be appreciated...

Thanks,
Bill Ellis

_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html

#6 lore raw
Quoted 4 lines · yves.alloyer

I did a quick and dirty patch which fixed it for me.
Please be aware: I am new to this list, new to linux LVM...
I know the patch will prevent you from using any partitioned MD device in LVM. I have no idea of further implications.

Yves, thanks this seems to have fixed this, i still agree with Andreas that lvm_check_partitioned_dev should be checked.
i wuld use LVM_DEVICE_TYPE_MD instead of 2 in the patch
as for partitioned md device i believe the major is different from 9, but i would not suggest using them with lvm anyway.

patch with my mod follows for the lazy,
pleas check it in cvs for the time being.

lib/lvm_check_partitioned_dev.c renamed from lib/lvm_check_partitioned_dev.c.bluca +2 -0
@@ -55,6 +55,8 @@
 	switch (lvm_get_device_type(st_rdev)) {
 	case LVM_DEVICE_TYPE_INVALID:
 	    break;
+	case LVM_DEVICE_TYPE_MD:
+	    break;
 	default:
 	    ret = TRUE;
 	}
Signature · 6 lines
Luca Berra -- [email protected]
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \