How to add a new LUN (disk) to an existing VG in SLES 11 SP1

Back in SLES 10, it was simple using Yast2 to add a new LUN to an existing volume group and then extend the logical volume space. Then, the LVM manager disappeared and it’s all handled by the Partitioner. I could have sworn that I’ve seen a way to add a new LUN from our NetApp to an existing VG, but I can’t find anything other than “Add Volume Group.” I don’t really want to add one, I just want to extend the VG to a new disk.

Is there a way to do this in Yast2? I can see the new “Physical Volumes,” but I don’t see any way to add them to an existing VG. Thanks.

Since my post, I have found and tried this, but with errors:

In Yast2, open the Partitioner.

In the left panel, select Volume Management and expand it to see the list of volume groups.

Under Volume Management, select the volume group, then click the Overview tab.

At the bottom of the page, click Resize.

I then add /dev/sdv (one of the new LUNs) and click “Finish.” This produces the following error:

Error

Failed to remove some physical devices.

I click OK on the error message and I change tabs to “Physical Volumes” from “Overview.” Here I see that the /dev/sdv appears to be added. I then click “Finish” again and get the following error:

Failure occurred during following action:
Extending volume group Oracle1 with /dev/sdv

System error code was: -4000

echo y|/sbin/pvcreate -ff -M2 ‘dev/sdv/’;
Can’t open /dev/sdv exclusively. Mounted filesystem?

Multipath -ll is showing me that “sdv” is the 102GB device that I want to add to the VG:

360a98000572d53504a5a6a5433745936 dm-27 NETAPP,LUN
size=102G features=‘1 queue_if_no_path’ hwhandler=‘0’ wp=rw
|-± policy=‘round-robin 0’ prio=4 status=active
| |- 0:0:1:5 sdv 65:80 active ready running
| - 1:0:1:5 sdx 65:112 active ready running -± policy=‘round-robin 0’ prio=1 status=enabled
|- 0:0:0:5 sdu 65:64 active ready running
`- 1:0:0:5 sdw 65:96 active ready running

Anyone know what is going on? What is my issue? Why won’t it work? I must be missing something simple. IMHO, Partitioner could have been much, much better at making it clear what needs to happen.

Does anyone read these forums?

Yes - but most only answer if they feel it’ll be helpful…

echo y|/sbin/pvcreate -ff -M2 ‘dev/sdv/’;
Can’t open /dev/sdv exclusively. Mounted filesystem?

What happens when you try to prepare & add the PV from the command line? Maybe indeed the PV is locked by a different access?

Regards,
Jens

[QUOTE=jmozdzen;4144]> echo y|/sbin/pvcreate -ff -M2 ‘dev/sdv/’;

Can’t open /dev/sdv exclusively. Mounted filesystem?

What happens when you try to prepare & add the PV from the command line? Maybe indeed the PV is locked by a different access?

Regards,
Jens[/QUOTE]

I haven’t tried the command line yet, but I am guessing the result would be the same as the pvcreate command above. However, these file systems are mounted, but this process of adding a disk to a VG should not require an unmounted file system. Is that not correct? If it has to be unmounted, there is less advantage to having LVM control.

dvbell,

I may be totally confusing what you’re trying to achieve, but:

  • you can dynamically add new PVs (physical volumes, AKA buckets of disk space) to a volume group. The PV is initially treated as free disk space
  • you can dynamically move used blocks between PVs of the same VG (volume group), i.e. to free up & delete a PV
  • you can dynamically assign free blocks of a VG to a LV (logical volume - where your file system ends up) to increase it’s size
  • you can dynamically resize a file system to make use of the added room created by increasing the LV size - if the file system supports this

I understood that you tried to add more free space to your VG by adding another PV to it (/dev/sdv).

Now if /dev/sdv is mounted, then you seem to have a file system on it already… but outside of the volume group. You cannot “import” a file system into a VG.

What are you trying to do? How familiar are you with LVM concepts?

Regards,
Jens

I’m very familiar.

I had a LUN exported from our NetApp to my server.
I see the disk as /dev/sdv on my server.
I try to add that disk to the VG I want to extend.
I then get the errors indicated earlier and I can’t add the disk to the VG.

I don’t know how to say it more simply. I haven’t had any luck with the paid-for support, so I thought I’d try the forums. :slight_smile:

Thanks.

dvbell,

I’m very familiar.

A good starting point :slight_smile:

So /dev/sdv is a disk with no mounted file system on it - then “pvcreate” shouldn’t complain. I’d actually try that manually and if it indeed fails, too, then try to get more details from pvcreate than the YaST-wrapped call exposes.

Is there a partition table on /dev/sdv? Then you might want to add the actual partition (or, for a test, zap the PT via “dd if=/dev/zero of=/dev/sdv bs=512 count=1” and try to re-run pvcreate).

Might it be that /dev/sdv does already contain a VG on it, from an earlier use? Then maybe some auto-something (probably udev) could have picked that up and activated that VG… or secretly added the PV to your exisiting VG (I have that problem with Xen DomUs if the VGs are equally named within Dom0 and DomU). Does “pvdisplay /dev/sdv” provide any hints?

Regards,
Jens

[QUOTE=jmozdzen;4162]dvbell,

So /dev/sdv is a disk with no mounted file system on it - then “pvcreate” shouldn’t complain. I’d actually try that manually and if it indeed fails, too, then try to get more details from pvcreate than the YaST-wrapped call exposes.

Is there a partition table on /dev/sdv? Then you might want to add the actual partition (or, for a test, zap the PT via “dd if=/dev/zero of=/dev/sdv bs=512 count=1” and try to re-run pvcreate).

Might it be that /dev/sdv does already contain a VG on it, from an earlier use? Then maybe some auto-something (probably udev) could have picked that up and activated that VG… or secretly added the PV to your exisiting VG (I have that problem with Xen DomUs if the VGs are equally named within Dom0 and DomU). Does “pvdisplay /dev/sdv” provide any hints?

Regards,
Jens[/QUOTE]

Here’s the pvcreate command:

pvcreate /dev/sdv

Can’t open /dev/sdv exclusively. Mounted filesystem?

Here is the pvdisplay command:

pvdisplay /dev/sdv

No physical volume label read from /dev/sdv
Failed to read physical volume “/dev/sdv”

And here is some fdisk info:

fdisk /dev/sdv

The number of cylinders for this disk is set to 13315.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:

  1. software that runs at boot time (e.g., old versions of LILO)
  2. booting and partitioning software from other OSs
    (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdv: 109.5 GB, 109521666048 bytes
255 heads, 63 sectors/track, 13315 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000e261f

Device Boot Start End Blocks Id System

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): v
213909503 unallocated 512-byte sectors

NOTE: This is not a previously used disk. It is a LUN that was created and exported to me. I should see it as a new disk. The disk should be empty and the info above seems to corroborate that. What do you think? And, thanks for your help.

[QUOTE=dvbell;4169]Here’s the pvcreate command: […]
NOTE: This is not a previously used disk. It is a LUN that was created and exported to me. I should see it as a new disk. The disk should be empty and the info above seems to corroborate that. What do you think? And, thanks for your help.[/QUOTE]

Yes, I fully agree that this seems to be a disk (LUN) without previous LVM “history”. (What I was referring to was that the space exported as your LUN might have been used earlier for a different LUN and there been in use with some VG.)

So the question remains: Why does pvcreate believe the device is open? lsof usually is of no help here… are you familiar with program debugging, i.e. running pvcreate via strace and checking the resulting calls for hints? (yes, I’m getting desperate :wink: )

Since you run multipathing, maybe something there confuses pvcreate - it shouldn’t of course, but who knows… I’m running out of ideas (and have not used multipathing yet, sorry).

Regards,
Jens

dvbell wrote:
[color=blue]

echo y|/sbin/pvcreate -ff -M2 ‘dev/sdv/’; Can’t open /dev/sdv
exclusively. Mounted filesystem? ---------

Multipath -ll is showing me that “sdv” is the 102GB device that I want
to add to the VG:

360a98000572d53504a5a6a5433745936 dm-27 NETAPP,LUN size=102G features=‘1
queue_if_no_path’ hwhandler=‘0’ wp=rw |-± policy=‘round-robin 0’ prio=4
status=active | |- 0:0:1:5 sdv 65:80 active ready running | - 1:0:1:5 sdx 65:112 active ready running -± policy=‘round-robin
0’ prio=1 status=enabled |- 0:0:0:5 sdu 65:64 active ready
running `- 1:0:0:5 sdw 65:96 active ready running --------

Anyone know what is going on? What is my issue? Why won’t it work?[/color]

Actually /dev/sdv is part of a multipathing group (sdv sdx sdu sdw). You
probably want to add the multipathing device dm-27 to the volume group.

Günther