Thursday, April 23, 2009

AIX - LVM - Create Logical Volume

Create LV

All the File systems belongs to individual LV, after creating the VG’s we should create the LV using mklv command

Suppose you want to create LV name as newlv

#mklv –y newlv –t jfs2 datavg 5 hdisk4

-y for confirmation
-t type mentioning the filesystem type i.e. jfs or jfs2,
Datavg – lv created on datavg
5 – 5 PP’s allocated for newlv ( 1 pp size 32MB the newlv size is 32MB*5 = 160MB)
Hdisk4 – that newlv is belongs to PV hdisk4

AIX - LVM - Varryoff Volume Group

Varryoff VG

This is just for VG deactivation; some clients want to deactivate VG for project Restriction. Suppose customer want deactivate testvg then your command will be

#lsvg –o
Rootvg
Datavg
Testvg

#Varryoff testvg

#lsvg –o
Rootvg
Datavg

The above command display only two online VG’s and it will not show testvg because testvg is offline VG.

AIX - LVM - VarryOn Volume Group

AIX - LVM - VarryOn Volume Group

Varryon VG

This is just for VG activation; some times clients want to deactivate VG for project restriction. After that we want to activate the VG for further data access

Suppose we want to activate testvg, then your command will be

#lsvg
Rootvg
Datavg
Testvg

The above command shows what are VG’s available

#lsvg –o
Rootvg
Datavg

The above commands shows only online VG’s because testvg is offline so we have to activate testvg

#varryonvg testvg

#lsvg –o
Rootvg
Datavg
Testvg

Now above command is display the testvg.

Wednesday, April 22, 2009

AIX - Reduce Volume Group

Reduce VG

We can remove the VG using reducevg command, if we want remove testvg and testvg has one pv hdisk9

#lsvg –p testvg
Hdisk9
#

Now we will remove the pv from testvg

#reducevg –f testvg hdisk9

f- option is used to force reduce, you have data in pv hdisk9, that time I will not any questions, directly it will remove the pv from testvg. Suppose 2 PV’s available in testvg then one by one we can reduce the PV’s

AIX -Extend Volume Group

AIX -Extend Volume Group

Extend VG

We can increase VG size by adding Pv into existing VG, example: extendvg command

#lsvg –p datavg
Hdisk4
Hdisk5
#
datavg has 2 PV’s now we want to extend datavg, then your command will be

#extendvg datavg hdisk6

After executed command hdisk6 pv added with datavg

#lsvg –l datavg
Hdisk4
Hdisk5
Hdisk6

AIX - List Volume Group

AIX - List Volume Group

List VG

We can list VG information using following commands

#lsvg – It will display the available vg’s
#lsvg datavg – It will display full details about datavg only
#lsvg –o It will display the online vg’s
#lsvg – l datavg – It will display the all logical volume details across the datavg
#lsvg –p datavg – It will display the information about all PV’s in datavg

Above operations can be performed by using lsvg commands

AIX - Create Voulme Group

AIX - Create Voulme Group

We can create VG by using mkvg commands

#mkvg –s 32 –y datavg hdisk4

The above command is creating datavg using pv hdisk4 and pp size is 32MB

#mkvg datavg hdisk4

The above command will create datavg using pv hdisk4 and pp size is by default 128MB.

Tuesday, April 21, 2009

AIX - LVM - Change Physical Volumes

AIX - LVM - Change Physical Volumes

If we have three PV’s, like hdisk0, hdisk1, hdisk2, now you want to deactivate the hdisk2,

#chpv -vr hdisk2 (To deactivate the hdisk2)
#chpv –va hdisk2 (To activate the hdisk2)
#chpv –an hdisk2 (hdisk2 is not allocatable)
#chpv –ay hdisk2 (hdisk2 is allocatable)
#chpv –hn hdisk2 (hotspare no)
#chpv –hy hdisk2 (Hotspare yes)
#chpv –c hdisk2 (To clear the boot image)

AIX - LVM - List Physical Volumes

AIX - LVM - List Physical Volumes

If we want to know how many PV’s available in server, The following command is list the Pv’s

#lspv

Hdisk0
Hdisk1
Hdisk2
#
The above command is used to display the pv availability

If you want to see particular PV information then your command will be

#lspv hdisk1

After executing lspv command it will display the hdisk2 PV information. All the information, like pp size, used pp’s, free pp, allocatable, hotspare etc.

If we want to see logical volumes details in single hdisk2 PV then your command will be

#lspv –l hdisk2

The above command is used to display all the LV details across the PV hdisk2

If we want to see pp storage information in hdisk2, then your command will be

#lspv –p hdisk2

The above command is display the pp usage information across the PV hdisk2

AIX - LVM (Logical Volume Manager)

AIX - LVM (Logical Volume Manager)


In AIX first Physical volumes (PV) are added into volume group(VG),
After that only we can create logical volumes, and file systems.

Minimum one PV is belongs to VG, While creating the VG we should mention physical partition (pp) size, this pp’s pointed to logical portions (LP),

Suppose we have 40GB HDD, we have added in one VG named DataVG , While creating the VG we should mention the pp size, i.e.

PP size will be 4MB to 128MB, suppose we are mentioned pp size is 32MB, then that 40GB HDD divided into


1024MB *40 = 40960MB

Each pp size is 32MB, then 40GB HDD spited into i.e.

40960 / 32 = 1280 PP’s

So DATAVG has 1280 PP’s

While creating the Logical volumes we should mention the lv size by giving the no of pp

Suppose you want to create one file system /userdata, that file system size will be 1GB, this file system is belongs to one particular LV, So while creating the LV we should mention the lv size is 1GB, but directly we cannot mention the GB size.

Each pp has 32MB, So you create LV with 315 PP’s, then that lv size will be 1GB.

After creating the LV using 1GB space we can increase LV size online, reboot is not required.

We can perform the following operation in LVM.

1. List PV
2. Change PV
3. Create VG
4. List VG
5. Extend VG
6. Reduce VG
7. Varryon VG
8. Varryoff VG
9. Create LV
10. List LV
11. Extend LV
12. Change LV
13. Create LV copy
14. Remove LV copy
15. Remove LV
16. Create FS
17. Change FS
18. List Fs
19. Mount FS
20. Unmount FS
21. Remove FS
22. Repair FS
23. Mirror VG
24. Syncvg
25. Unmirror VG
26. Migrate PV
27. Migrate LV
28. Export VG
29. Import VG
30. Change VG

NOTE:

After AIX installation by default root volume group (rootvg) will be available