Operating System - HP-UX
1831403 Members
3196 Online
110025 Solutions
New Discussion

Add 2 new hard disks to existing mirror

 
SOLVED
Go to solution
TANHM
Advisor

Add 2 new hard disks to existing mirror

Hi All,

I need some advise from experts here.
My system HP-UX (11.11) has 3 volume group, one of the volume group vg02, have 2 lvols reached 88% each and this vg02 consists of 2 PV (Hard disks 36GB each) and it is mirror between these 2 hard disks. Recently I have bought 2 new harddisks (also 36GB each). So my question is, how can I add this 2 new hard disks to vg02 and mirror them. So after adding these 2 new hard disks, the source disks (2 disks-one old and 1 new) will become 36GB +36GB and the mirror disks (2 disks-one old and 1 new) will also become 36GB +36GB.

Thanks in advance
22 REPLIES 22
Pete Randall
Outstanding Contributor

Re: Add 2 new hard disks to existing mirror

First you need to pvcreate the disks, then vgextend the volume group, then lvextend the mirrors onto them. That's all there is to it.


Pete

Pete
Jeff Schussele
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,

Pete has summed it up rather nicely & it is really that easy.
But I would like to point out that mirroring is at the LV level - not the PV nor VG level.
This means that you could have multiple LVs in a VG and mirror some of them, you don't have to mirror all of them.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sanjay_6
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,

Like it is said,

Do "vgextend" for each of these new disk to include them into the vg and then do a lvextend/fsadm or lvextend/extendfs to extend the lv and the mirrors on the new disk.

While doing an lvextend, add both the pvs over there and the primary and the mirror would be placed on different disks,

lvextend -L new_size_in_MB /dev/vg_name/lv_name /dev/dsk/ist_disk /dev/dsk/2nd_disk

If you have used PVG while creating the vg and chose the option -s g while creating the lv, it makes sure that the primary and the mirror copies are always on different disks. Do "man lvcreate" to know more about this option. May help in future.

This link may help understand the concept of PVG,

http://docs.hp.com/en/B2355-90682/lvmpvg.4.html

Hope this helps.

Regds
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Hi All,

Thanks for your response to the question. The current 2 disks in vg02 are /dev/dsk/c5t8d0 and /dev/dsk/c7t8d0 and both are mirror to each other. Lets say after I install or add the 2 new hard disks (/dev/dsk/c5t10d0 and /dev/dsk/c7t10d0). I shall isssue the following commands:

extend the volume group of vg01:
vgextend /dev/vg02 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

extend the lvols (/dev/vg02/lvol1 and /dev/vg02/lvol2):

lvextend -L Disk_Size /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

Is the above commands can perform correct and able to perform what I want, do I need to issue lvextend -m 1 /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0 in order to mirror the 2 new disks??

Thanks in advance
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Sorry,

For the lvextend part, the commands are:

lvextend -L Disk_Size /dev/vg02/lvol1 /dev/dsk/c5t8d0 /dev/dsk/c5t10d0

lvextend -L Disk_Size /dev/vg02/lvol2 /dev/dsk/c5t8d0 /dev/dsk/c5t10d0

Next is to mirror ??:

lvextend -m 1 /dev/vg02/lvol1 /dev/dsk/c7t8d0 /dev/dsk/c7t10d0

lvextend -m 1 /dev/vg02/lvol1 /dev/dsk/c7t8d0 /dev/dsk/c7t10d0

Are the commands correct??

Thanks in advance
Hoang Chi Cong_1
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi TANHM

No, the command you show us is not correct. 1. first extend all the new disks to the exiting VG:
vgextend /dev/vg02 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

2. Then mirror:

lvextend -m 1 /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0
lvextend -m 1 /dev/vg02/lvol2 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0
3. Then extend the LV.
lvextend -L size_in_MB_want_to_extend /dev/vg02/lvol1
lvextend -L size_in_MB_want_to_extend /dev/vg02/lvol2


Hope this helps
Regard,
HoangChiCong
Looking for a special chance.......
Bharat Katkar
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,
I think the right would be as follows:
Assuming you have lvol1 and lvol2 created on /dev/dsk/c5t8d0 and are mirrored on /dev/dsk/c7t8d0.
Now.
0. vgextend with two PV's say PV1 and PV2
1. Umount the filesystems.
2. lvreduce -m 0 ( to break the mirroring)
3. lvextend -L ( Use /dev/dsk/c5t10d0 here )
4. extendfs filesystem
5. lvextend -m 1 ( Use c7t10d0 here )
e.g you extended lvol1 on /dev/dsk/c5t10d0 and want to mirror it on /dev/dsk/c7t10d0 then:
# lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c7t10d0

Go through the command syntax properly.
Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: Add 2 new hard disks to existing mirror

hi,
one typo..
please read
"# lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c7t10d0"
as
"# lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c7t10d0"

regards,


You need to know a lot to actually know how little you know
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Hi Bharat,

After u break the mirror for /dev/dsk/c5t8d0 and /dev/dsk/c7t8d0. For your example, U mirror only the new disks (/dev/dsk/c7t10d0) but what about the old disk /dev/dsk/c7t8d0??
or is it you miss out??

For example:
lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c7t8d0 /dev/dsk/c7t10d0

Thanks in advance
Bharat Katkar
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Well the thing should be like break the mirror. Then you only have single LV say lvol1. Then extend it and mirror it. I don't know what size it is and whether it spans two disks.?
Regards,
You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: Add 2 new hard disks to existing mirror

sorry i just got out of the scene...

Now here it is:

If both the lv's lvol1 and lvol2 are 36 GB each then you can use One disk each per lv for mirror and if they are of different sizes then you need to create one single PVG of two newly added disk and use PVG name instead to keep your mirrors of two lv's.

Regards,
You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,
You said:
"U mirror only the new disks (/dev/dsk/c7t10d0) but what about the old disk /dev/dsk/c7t8d0??
or is it you miss out??"

Well when you break the mirror you have lv only on one disk i.e. c5t8d0 and since you have no mirror now c7t8d0 is free.

Now you add one disk (say c5t10d0) to data disk (c5t8d0) i.e. you extend your lv on that disk only. Call this as data set.

Then you get your free old disk (c7t8d0) and the new one c7t10d0 and form one PVG on which your mirrors of lvol1 and lvol2 will reside. This will be your mirror set.

So while mirroring you only have to mention the disk or PVG on which you are mirroring.

# lvextend -m 1 lvpath pv_path_or_PVGname

This will take care of lv which are greater than 36 gb also. Becasue after making PVG you will see consolidated storage of 72gb.

Hope that helps.
Regards,

You need to know a lot to actually know how little you know
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Hi Bharat,

Regarding your sentence below:

"So while mirroring you only have to mention the disk or PVG on which you are mirroring.

# lvextend -m 1 lvpath pv_path_or_PVGname"


Is it correct for me to issue the following commands:

a)
lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c7t8d0 /dev/dsk/c7t10d0

or

b)
lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c7t8d0

lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c7t10d0

Please advise
Bharat Katkar
Honored Contributor
Solution

Re: Add 2 new hard disks to existing mirror

Hi,

1. Create file lvmpvg in etc directory.
# vi /etc/lvmpvg
Press insert (i key) and cut paste the
information below in that file.

VG /dev/vg02
PVG PVG0
/dev/dsk/c7t8d0
/dev/dsk/c7t10d0

Press then :x
Your file will be saved

Now your lvextend command:

# lvextend -m 1 /dev/vg02/lvol1 PVG0
# lvextend -m 1 /dev/vg02/lvol2 PVG0

That's all.
Regards,

p.s. Read Sanjay's post carefully.



You need to know a lot to actually know how little you know
Sanjay_6
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,

this is how you do this,

Say you already have lvol1 & lvol2 in /dev/vg02 and the disks you are currently using are /dev/dsk/c5t8d0 & /dev/dsk/c7t8d0 and the lvs are currently mirrored. Now you want to add /dev/dsk/c5t10d0 & /dev/dsk/c7t10d0 and extend the lvs and their mirrors on these new disks.

You do not have to break the mirror, do lvextend and extend the lv on the new disks,

Do pvcreate first, use -f if necessary.

pvcreate /dev/rdsk/c5t10d0
pvcreate /dev/rdsk/c7t10d0

Next add them into the vg,

vgextend /dev/vg02 /dev/dsk/c5t10d0
vgextend /dev/vg02 /dev/dsk/c7t10d0

Now extend the lvs and their mirros on these new disks,

lvextend -L new_size_in_mb /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0
lvextend -L new_size_in_mb /dev/vg02/lvol2 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

If you have onlineJFS you can use fsadm to extend the filesystem without unmounting the filesystem,

fsadm -F vxfs -b new_size_in_block /mount_point

If you don't have onlineJFS, you'll have to unmount the filesystem and then use extendfs to extend the filesystem.

Hope this helps.

Regds
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Hi Sanjay and bharat,

Tkx for your reply.

Sanjay as you mention:

Now extend the lvs and their mirros on these new disks,

lvextend -L new_size_in_mb /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0
lvextend -L new_size_in_mb /dev/vg02/lvol2 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

Seem like you miss out -m 1:

lvextend -L new_size_in_mb -m 1 /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

lvextend -L new_size_in_mb -m 1 /dev/vg02/lvol2 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

Or without -m will also create the mirror.

I doubt without -m 1 will create a mirror.
Correct me if I am wrong.

Thanks in advance
Sanjay_6
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,

no i did not miss out on -m 1, since the mirror already exist.

when you extend an lv that is already mirrored you don't have to specify -m 1 again.

just do lvextend -L new_size lv_name pv1_name pv2_name

You have to specify a -m 1 option when the lv is not mirrored and you want to create a new mirror, which i was assuming is not the case with you in this situation.

Hope this helps.

Regds
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Hi Sanjay,

U mean by using lvextend -L new_size_in_mb /dev/vg02/lvol1 /dev/dsk/c5t10d0 /dev/dsk/c7t10d0

LVM will know and assisg /dev/dsk/c5t10d0 to data disk and /dev/dsk/c7t10d0 and automatically mirror them??

Thanks in advance
Sanjay_6
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Hi,

Yes, that is currect. lvm would use the 1st pv for the primary copy and the 2nd pv as the mirror copy when two pvs are specified in the lvextend command for a mirrored lv.

Hope this helps.

Regds
Ted Buis
Honored Contributor

Re: Add 2 new hard disks to existing mirror

Could this have been done with 'sam'?
Mom 6
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Hi Sanjay,

Tkx for your information.

Thanks & Best Regards
TANHM
Advisor

Re: Add 2 new hard disks to existing mirror

Completed