Operating System - HP-UX
1833461 Members
3170 Online
110052 Solutions
New Discussion

Re: Removing unused physical disks and adding bigger physical disks

 
Terry Kummell
Advisor

Removing unused physical disks and adding bigger physical disks

We are in the process of migrating an application from a G50 to a T600. We need to create a new VG for the application on the T600. There is an existing VG (VG08) that has 8 2GB drives. Only the first three drives have a logical volume. I would like to remove four of the 2GB drives from VG08 and replace them with the larger drives. At that point, I would like to create a new VG using the new drives. Does anyone know how that could be accomplished?

Many thanks!
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: Removing unused physical disks and adding bigger physical disks

Unless vg08 was initially created to allow excess PE's (and that is not the dewfault behavior) then this is not going to work. If you add 8GB drives, I can almost assure you that all you will get from each of these is 2GB; the remainder will be wasted. You are going to have to backup and recreate the VG starting with your largest disks. That will automatically create the vg with enough physical extents.
If it ain't broke, I can fix that.
Michael Tully
Honored Contributor

Re: Removing unused physical disks and adding bigger physical disks

You need to have a look closely at this.
Removing the old LUN's can easily be done, but adding larger LUN's to a volume group with smaller LUN's will only give you access to the size of the smaller LUN's. Unfortunately when a volume group is created with the first LUN, that is the maximum size of any LUN that can be added later. You are better off creating a new volume group and starting fresh.
To create a new VG (check the minor number before using it 0x030000 is an example. You can check the used number by ll /dev/*/group
e.g.
# mkdir /dev/myvg
# mknod /dev/myvg/group c 64 0x030000
# pvcreate /dev/rdsk/cxtydz
# vgcreate -p 128 /dev/myvg /dev/dsk/cxtydz
# lvcreate -n -r N /dev/myvg/mylvol
# lvextend -L 1024 /dev/myvg/mylvol

The man pages provide some additional exmaples from these commands.

To remove the LUN's e.g.
# vgreduce /dev/myvg /dev/dsk/cxtydz
Anyone for a Mutiny ?
James R. Ferguson
Acclaimed Contributor

Re: Removing unused physical disks and adding bigger physical disks

Hi Terry:

There is an inherent problem in this. Unless you had the foresight to *originally* create the volume group with enough PE entents ('max_pe' and 'pe_size') to accomodate accessing all the physical extents available in new, large (18Gb or 36GB or 72GB) drives, any physical volumes you add to the volume group (with 'vgextend') will be constrained by the *original* LVM geometry. Your only choice is to backup the data on vg08. 'vgexport' it to remove it from the system; 'vgcreate' it using "reasonable" values for 'max_pe' and 'pe_size'; recreate your logical volumes and filesystems and reload your data!

To do otherwise (i.e. to simply 'vgreduce' the physical volumes (pv_paths) you don't want) and then to 'vgextend' new physical volumes, which represent larger disks, into the volume group, will mean that you will not be able to access the full number of physical extents on the new disks, thereby defeating the whole exercise of adding larger disks.

Therefore, 'vgreduce' the physical drives (pv_paths) you don't want from vg08. Use 'pvmove' if necessary to transfer extents from the devices you want to relinquish to the devices that will remain as vg08. Then swap your old physical disk for new ones. 'pvcreate' each new disk and build a new volume group and logical volumes beginning with 'vgcreate' and "reasonable" values for 'max_pe' and 'pe_size'.

See the man pages for the aforementioned commands for more information.

Regards!

...JRF...
Terry Kummell
Advisor

Re: Removing unused physical disks and adding bigger physical disks

My intention is to reduce the size of VG08 and remove the four empty 2GB hard drives. Then create an entirely new VG (VG09 for example) with the new physical drives. So the issue of max_pe shouldn't be a problem... I think.

The problem is that I don't have any slots in the existing jamaica boxes to add the new hard drives. So I am forced to remove some, as yet, unused small drives (2GB drives), and add the larger drives in their place.

My questions then are:

1. How do I remove a physical from a volume group?

2. Are there any gotcha's in reusing the scsi ids associated with the Jamaica box?
James R. Ferguson
Acclaimed Contributor

Re: Removing unused physical disks and adding bigger physical disks

Hi (again):

1: Use 'vgreduce vgNN /dev/dsk/cXtYdz' for each of the physical disk you want to remove.

2. No.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Removing unused physical disks and adding bigger physical disks

If there are no extents being used in the disks in question then all that is required is a vgreduce vg08 /dev/dsk/c3t4d0 /dev/dsk/c3t5d0 ... . This will work for all but the last disk which must be removed with vgexport.

By the way. vgexport is non-destructive so that if you remember which disks made up the vg, it's very easy to recreate the vg using vgimport.


If you want to blow away the entire VG (after backing up) then simply vgexport /dev/vg00 and 'poof' ... it's gone.

There is no problem at all in using the same SCSI target id's; the only restriction is that any disk (target) can belong to at most 1 VG at any one time.

Man vgreduce, vgexport for details.
If it ain't broke, I can fix that.
Tim Adamson_1
Honored Contributor

Re: Removing unused physical disks and adding bigger physical disks

Use vgreduce to reduce the unused disks out of the VG.

# vgreduce /dev/vg08 /dev/dsk/c?t?d?


When you create your new VG, it would be advantageous to create it to allow for bigger capacity disks to be added just in case you do that some time in the future. For the sake of an extra option NOW, you will save a headache later.


Tim
Yesterday is history, tomorrow is a mystery, today is a gift. That's why it's called the present.