Operating System - HP-UX
1834931 Members
3292 Online
110071 Solutions
New Discussion

Re: New disks that need to be mirrored

 
SOLVED
Go to solution
Jason_309
Regular Advisor

New disks that need to be mirrored

I have 4 new disks (c4t6d0,c5t6do,c6t14d0 and c7t14do) I want to create a new vg03. The four disks are to be 2 new lvo's that are mirrored by the other two disks. Can i get some help with this. This is the first time adding new disks. Thanks
13 REPLIES 13
Ivan Ferreira
Honored Contributor

Re: New disks that need to be mirrored

To create a new VG

mkdir /dev/vgXX

Where XX is a two digit number not yet used.

mknod /dev/vgXX/group c 64 0xNN0000

Where NN runs from 00 to ff and is not yet used by another VG.


pvcreate /dev/rdsk/c4t6d0

pvcreate /dev/rdsk/c5t6d0

pvcreate /dev/rdsk/c6t14d0

pvcreate /dev/rdsk/c7t14d0


Create the volume group

vgcreate -s 16 /dev/vgXX /dev/dsk/c4t6d0 /dev/dsk/c5t6d0 /dev/dsk/c6t14d0 /dev/rdsk/7t14d0


Create the logical volume with the -m option (Mirror copies)

lvcreate -n LV_NAME -L LV_SIZE -m 1 -s y -c y

Create the file system and mount it as usual.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Kent Ostby
Honored Contributor

Re: New disks that need to be mirrored

Here's a document that has examples to walk you through.

http://docs.hp.com/en/B2355-90950/ch09s01.html
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Devender Khatana
Honored Contributor

Re: New disks that need to be mirrored

Hi,

Allthough you did not mentioned the disk sizes and the LVOL sizes but I will assume one LVOL of the size of one disk and being mirrored across other.

#pvcreate /dev/rdsk/c4t6d0

Repeat for other 3 disks and use -f option if it is not successful with this (Reason being the disks were in use in LVM earlier)

#mkdir /dev/vg03
#mknod /dev/vg03/group c 64 0x030000

(ll /dev/*/group to confirm that 0x030000 is not used for any existing VG and if used next number i.e. 0x040000 or whatever available.)

#vgcreate /dev/vg03 -e 15000 -s 32 /dev/dsk/c4t6d0

#lvcreate -L xxxx /dev/vg03
#newfs -F vxfs /dev/vg03/rvol1

Where xxxx is the size of the disk /dev/dsk/c4t6d0 in MB.
#vgextend /dev/vg03 /dev/dsk/c5t6d0
#lvextend -m 1 /dev/vg03/lvol1 /dev/dsk/c5t6d0

#vgextend /dev/vg03 /dev/dsk/c6t14d0

#vgextend /dev/vg03 /dev/dsk/c7t14d0

#lvcreate /dev/vg03
#lvextend -L xxxx /dev/vg03/lvol2 /dev/dsk/c6t14d0
#newfs -F vxfs /dev/vg03/rlvol2
#lvextend -m 1 /dev/vg03/lvol2 /dev/dsk/c7t14d0

Create desired mount point and mount them. Make entries in /etc/fstab and also check vgdisplay -v and lvdisplay -v outputs.

HTH,
Devender
Impossible itself mentions "I m possible"
Jason_309
Regular Advisor

Re: New disks that need to be mirrored

Thank you all for your help. The disks are 146GB disks. Can this be done while my databases are up and running?
Tiziano Contorno _
Valued Contributor

Re: New disks that need to be mirrored

W A R N I N G
no Guru advise here:

pvcreate each disc:
pvcreate /dev/rdsk/
....
pvcreate /dev/rdsk/

Prepare VG tree:
mkdir /dev/
mknod /dev//group c 64 0xNN0000 (use a free minor number, see bottom page)

Create VG:
vgcreate /dev/dsk/ ... /dev/dsk/

Define 2 PVG updating/creating the file /etc/lvmpvg with this info:

VG /dev/
PVG PVG1
/dev/dsk/
/dev/dsk/
PVG PVG2
/dev/dsk/
/dev/dsk/

Create an empty LV
lvcreate -n -s g

Extend it to the first PVG:
lvextend -L /dev// PVG1

Mirror it on the second PVG:
lvextend -m 1 /dev// PVG2

Example to find first free minor number:
ll /dev/*/group
crw-r----- 1 root sys 64 0x000000 May 5 2004 /dev/vg00/group
crw-rw-rw- 1 root sys 64 0x010000 May 10 2004 /dev/vgnnm/group
In this case you can use 02 (i.e.: mknod /dev//group c 64 0x020000).

Regards.
Devender Khatana
Honored Contributor

Re: New disks that need to be mirrored

Hi,

The steps mentioned in earlier thread were enough to accomodate the disks of capacity upto around 480 GB so 146 GB is not a problem.

Just mentioned the LVOL sizes accordingly. Suppose if you wish to have two lvols of 146GB each then in first lvcreate use xxxx to be 148000 but it should not be more than that of one indivisual disk capacity.

HTH,
Devender
Impossible itself mentions "I m possible"
Tiziano Contorno _
Valued Contributor

Re: New disks that need to be mirrored

Jason, you can create the LVs while the database is running. The DBA will then add new datafiles to the DB using these new LVs.

DBAs may use datafiles on
1) filesystem;
2) raw device.

Case 1)
Create the filesystems on both the LVs:
newfs -F vxfs -o largefiles /dev//r
### Mind the r before lvol name ###
Note: you can specifiy a custom block size for the LV above (some use 8192):
newfs -F vxfs -o largefiles -b 8192 /dev//r
Repeat for the other LV.

Mount them:
mkdir
mount -F vxfs -o largefiles /dev//r /
mount -F vxfs -o largefiles /dev//r /

Tell the DBA to add datafiles in / and /


Case 2)
Just tell the DBA to use /dev//r and /dev//r

Regards.
Jason_309
Regular Advisor

Re: New disks that need to be mirrored

Can this be done using sam?
Devender Khatana
Honored Contributor

Re: New disks that need to be mirrored

Hi,

Yes you can use SAM also to achive this but then you will have to use some trick here as well otherwise you can not really control which disk should hold your particular file system.

Create VG on only one disk then create file system on the whole disk, then add one disk to the VG and extend the file system to the whole disk using mirroring option. Repeat same after extending to 3rd and mirroring to 4th.

In the end crosscheck with vgdisplay and lvdisplay commands before using.

HTH,
Devender
Impossible itself mentions "I m possible"
Senthil Kumar .A_1
Honored Contributor

Re: New disks that need to be mirrored

Hey Jason,

Since you say ,these are new disks, why not try from command prompt itself instead of SAM. That way you know what's actually happening. If you were to become a HPUX admin, better get used to the command prompt as early as possible. The command prompt way acheving the target solutions will help you in the long run as far as troubleshooting is concerned. I do not think creating VG's through command prompt is too risky. In case you encounter any, We are always here to support you.

Regards,
Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Jason_309
Regular Advisor

Re: New disks that need to be mirrored

Senthil,
I would rather do it from the command line, but i am not following the steps. I could just do what it says but not really sure what is happening in all the parts.
Tiziano Contorno _
Valued Contributor
Solution

Re: New disks that need to be mirrored

Explaining each step, using c4t6d0,c5t6d0,c6t14d0 and c7t14d0
and VG name = vg_ora

pvcreate each disc, to initialize them to be used:
pvcreate /dev/rdsk/c4t6d0
pvcreate /dev/rdsk/c5t6d0
pvcreate /dev/rdsk/c6t14d0
pvcreate /dev/rdsk/c7t14d0

Prepare VG tree, to store the new VG special files:
mkdir /dev/vg_ora
mknod /dev/vg_ora/group c 64 0x060000
(in case 06 is a free minor number)

Create VG, this command write to the disks info on the reserved area
to identify them as belonging to the new volume group
WRITE ALL IN A LINE:
vgcreate vg_ora /dev/rdsk/c4t6d0 /dev/rdsk/c5t6d0 /dev/rdsk/c6t14d0 /dev/rdsk/c7t14d0

Define 2 PVG updating/creating the file /etc/lvmpvg.
PVG stands for Phisycal Volume Group,
they permit to define/manage/distinguish physical

disks in "sets".
You can use PVG names instead of the list of devices
they are composed of.

So, in /etc/lvmpvg file you put:

VG /dev/vg_ora
PVG PVG1
/dev/dsk/c4t6d0
/dev/dsk/c5t6d0
PVG PVG2
/dev/dsk/c6t14d0
/dev/dsk/c7t14d0

Create the LV you need, you create them as empty LV at first,
specifying that mirror copies of data
of the first PVG MUST be in the other PVG:

lvcreate -n lv_ora1 -s g vg_ora
lvcreate -n lv_ora2 -s g vg_ora

Now you give them a size:
lvextend -l /dev/vg_ora/lv_ora1 PVG1
lvextend -l /dev/vg_ora/lv_ora2 PVG1
FOR see below.

Now you create a mirror copy of the 2 LVs on the other set of disks:
lvextend -m 1 /dev/vg_ora/lv_ora1 PVG2
lvextend -m 1 /dev/vg_ora/lv_ora2 PVG2

To find correct value of , do a:
vgdisplay vg_ora

LE_NUMBER= (Total PE) / 4
Why: All the disk space we have is half for the mirror.
So we are at (Total PE) / 2.
This space is for 2 LV so the size of each LV is (Total PE) / 4.

Regards.
Jason_309
Regular Advisor

Re: New disks that need to be mirrored

Thank you very much for the help. I will give points to all.