Hi,

i have a HP Raid controller with a RAID 5 configuration. A lot of the disk space was not used until now. I want to add the unused space to a volume group. With fdisk i created a further partition:

Code:
ha-idg-2:~ # fdisk -l

Disk /dev/cciss/c0d0: 1200.2 GB, 1200186941440 bytes
255 heads, 32 sectors/track, 287269 cylinders, total 2344115120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00032ae8

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1            2048   618663935   309330944   8e  Linux LVM
/dev/cciss/c0d0p2       618663936   622856191     2096128   82  Linux swap / Solaris
/dev/cciss/c0d0p3   *   622856192   623884287      514048   83  Linux
/dev/cciss/c0d0p4       623884288  2344115119   860115416   8e  Linux LVM
c0d0p4 has just been created, i cahnged the type to 8e.

But i can't create the respective physical volume:

Code:
ha-idg-2:~ # pvcreate -dv /dev/cciss/c0d0p4
pvcreate  Can't open /dev/cciss/c0d0p4 exclusively.  Mounted filesystem?
A mounted fs is surely not the reason, the partition is freshly created. Partprobe didn't help.
I found out that device-mapper feels responsible for this device:

Code:
Disk /dev/mapper/3600508b1001c5037520913a9b581d78d: 1200.2 GB, 1200186941440 bytes
255 heads, 63 sectors/track, 145914 cylinders, total 2344115120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00032ae8

                                        Device Boot      Start         End      Blocks   Id  System
/dev/mapper/3600508b1001c5037520913a9b581d78d_part1            2048   618663935   309330944   8e  Linux LVM
/dev/mapper/3600508b1001c5037520913a9b581d78d_part2       618663936   622856191     2096128   82  Linux swap / Solaris
/dev/mapper/3600508b1001c5037520913a9b581d78d_part3   *   622856192   623884287      514048   83  Linux
That's exact the same layout as for /dev/cciss/c0d0, except partition 4.
Strange. I thought that dm is reponsible for logical volumes, RAID, multipath, but not for plain partitions.
I tried to force device-mapper to rescan the disk, so that it knows about the new partition.
I tried /etc/init.d/boot.device-mapper stop and afterwards start, but it still does not see the new partition.

Then i tried kpartx to reread the disk, and it created new entries in /dev/mapper:

Code:
ha-idg-2:~ # ll /dev/mapper/
total 0
lrwxrwxrwx 1 root root       7 Jul 21 17:13 3600508b1001c5037520913a9b581d78d -> ../dm-0
lrwxrwxrwx 1 root root       7 Jul 21 17:13 3600508b1001c5037520913a9b581d78d_part1 -> ../dm-2
lrwxrwxrwx 1 root root       7 Jul 21 17:13 3600508b1001c5037520913a9b581d78d_part2 -> ../dm-3
lrwxrwxrwx 1 root root       7 Jul 21 17:13 3600508b1001c5037520913a9b581d78d_part3 -> ../dm-4
lrwxrwxrwx 1 root root       7 Jul 21 17:13 3600c0ff00012824b04af7a5201000000 -> ../dm-1
lrwxrwxrwx 1 root root       8 Jul 21 17:25 c0d0p1 -> ../dm-10
lrwxrwxrwx 1 root root       8 Jul 21 17:25 c0d0p2 -> ../dm-11
lrwxrwxrwx 1 root root       8 Jul 21 17:25 c0d0p3 -> ../dm-12    <==============
lrwxrwxrwx 1 root root       8 Jul 21 17:25 c0d0p4 -> ../dm-13
now it works:

Code:
ha-idg-2:~ # pvcreate -dv /dev/mapper/c0d0p4

pvcreate    Set up physical volume for "/dev/mapper/c0d0p4" with 1720230832 available sectors
pvcreate    Zeroing start of device /dev/mapper/c0d0p4
pvcreate    Writing physical volume data to disk "/dev/mapper/c0d0p4"
pvcreate    Wiping cache of LVM-capable devices
pvcreate  Found duplicate PV pffUbBgEXgVeDgbDYO0J0tkHpZyFanUg: using /dev/mapper/c0d0p1 not /dev/mapper/3600508b1001c5037520913a9b581d78d_part1
pvcreate  Physical volume "/dev/mapper/c0d0p4" successfully created
It says that it found one pv twice (partition 1), probably because i have now a new entry /dev/cciss/c0d0p1 pointing to the same pv.

Is this the right procedure ? Or is there a way to have a /dev/mapper/3600508b1001c5037520913a9b581d78d_part4 ?
That would be more consistent.

Bernd