Vous êtes sur la page 1sur 31

HPUXLVM,DiskandFileSystem

Tasks

TableofContents

1.BasicTasks........................................................................................................................................................................1
2.RecognizingandInitializinginLVManewlyaddedDisk/LUN(Discovery/Rescan)2
3.RemovingaPhysicalVolume.................................................................................................................................2
4.CreatingaVolumeGroup.........................................................................................................................................3
5.AddingaDisktoaVolumeGroup......................................................................................................................4
6.RemovingaDiskfromaVolumeGroup.........................................................................................................5
7.RemovingaVolumeGroup......................................................................................................................................5
8.CreatingaLogicalVolumeandMountingitsFileSystem..................................................................6
9.ExtendingaLogicalVolumeanditsFileSystem.......................................................................................8
10.ReducingaLogicalVolumeanditsFileSystem.....................................................................................9
11.AddingaDisktoaVolumeGroupandCreatingaLogicalVolume.........................................9
12.AddingaDisk,CreatingaVolumeGroupandCreatingaLogicalVolume.....................10
13.AddingaDisktoaVolumeGroupandExtendingaLogicalVolume..................................11
14.AddingaLUN/ExternalDisk,ExtendingtheVolumeGroupandtheLogicalVolume11
15.ImportingandExportingVolumeGroups.................................................................................................12
16.RemovingaLogicalVolume..............................................................................................................................13
17.MovingDisksWithinaSystem(LVMConfigurationwithPersistentDeviceFiles)..13
18.MovingDisksWithinaSystem(LVMConfigurationwithLegacyDeviceFiles)........14
19.MovingDisksBetweenSystems..................................................................................................................14
20.MovingDatatoaDifferentPhysicalVolume........................................................................................15
21.ReplacingaMirroredNonBootDisk...........................................................................................................15
22.ReplacinganUnirroredNonBootDisk.....................................................................................................16
23.ReplacingaMirroredBootDisk......................................................................................................................17
24.CreatingaSpareDisk............................................................................................................................................18
25.ReinstatingaSpareDisk.....................................................................................................................................18
26.ChangingPhysicalVolumeBootTypes...................................................................................................19
27.EnablingandDisablingaPathtoaPhysicalVolume......................................................................19
28.CreatinganAlternateBootDisk.....................................................................................................................20
29.MirroringtheBootDisk..........................................................................................................................................21
30.MirroringtheBootDiskonHP9000Servers........................................................................................22
31.MirroringtheBootDiskonHPIntegrityServers.................................................................................22
32.BackingUpaMirroredLogicalVolume.....................................................................................................23
33.BackingUpandRestoringVolumeGroupConfiguration............................................................24
34.QuiescingandResumingaVolumeGroup............................................................................................25
35.AddingaMirrortoaLogicalVolume..........................................................................................................25
36.RemovingaMirrorfromaLogicalVolume.............................................................................................26
37.IncreasingthePrimarySwap..........................................................................................................................26
38.IdentifyingAvailableDiskstobeUsedinaVolumeGroup........................................................26
39.CreatingaPhysicalVolumeGroup(PVG).............................................................................................28

40.Creating(Mirroring)LogicalVolumesonSpecificPhysicalVolumes................................29

1.BasicTasks

Searchforattacheddisk:
ioscanfnCdisk
GetDiskInfo:
diskinfo/dev/rdsk/c0t1d0
InitializeadiskforusewithLVM:
pvcreatef/dev/rdsk/c0t1d0
Initializethediskandcheckthediskforbadblocks:
mediainit/dev/rdsk/c0t1d0
Displayvolumegroupinfo:
vgdisplayvvg01

2.RecognizingandInitializinginLVManewlyaddedDisk/LUN(Discovery
/Rescan)

AsanewdiskisaddedtotheserveroranewLUNisassignedtothehost,youhavetoexecutethefollowingprocedureforthe
operatingsystemtodiscoverythedisk/LUNandtheLVMtoinitializeit.
Checkforthenewhardware(thenewdeviceswillhaveahardwarepath,butnodevicefileassociatedwithit):
ioscanfnCdisk|more
Createthedevicefileforthehardwarepath:
insf
Ifusingvpathsthencreatethevpathassociation:
/opt/IBMdpo/bin/cfgvpath
/opt/IBMdpomaynotbethepathofthesddsoftware,sorun"whereiscfgvpath"tofindthecorrectpath.

Verifythenewdevices/vpaths:
ioscanfnCdisk
strings/etc/vpath.cfg
/opt/IBMdpo/bin/showvpath
Createthephysicalvolume(InitializethediskforusewithLVM).
Foreachdisk(notvpath)issue:
pvcreatef/dev/rdsk/cxtxdx
Forvpathsthisinformationcanbefoundinthefile/etc/vpath.cfg.

3.RemovingaPhysicalVolume

Tosimplyremoveaphysicalvolumethat'snotusedandreferredbyLVMstructures(volumegroupsandlogicalvolumes)follow
thisquickprocedure.
ToremoveaphysicalvolumeusedandreferredbyLVMstructuresyoufirsthavetoremovethelogicalvolumesandthevolume
groupswhichrelyonitbyfollowingtheproceduresdetailedinthesectionsbelow(RemovingaLogicalVolumeandRemoving
aVolumeGroup)andthenyoucanissuethecommandsinthissection.
Identifythehardwarepathofthedisktoremove:
ioscanfnCdisk
Removethespecialdevicefile:
rmsfH<HW_path_from_ioscan_output>

4.CreatingaVolumeGroup

Createthedevicestructureneededforanewvolumegroup.
Inthemknodcommand the group number (the last parameter) is an hexadecimal and it should be different for each volume
group.Forexample,forthevolumevg02,tipicallythesecondvolumecreated)thatnumberwouldbe0x020000.
Thedefaultlimitis10volumegroupsassetbythekernelparametermaxvgs.
mkdir/dev/vgdatacdvgdata
mknodgroupc640x010000
chownRroot:sys/dev/vgdata
chmod755/dev/vgdata
Create volume group vgdata I suggest NOT to use the default values for s (physical_extend_size=4MB) and to do use
e(max_physical_extends=1016):
vgcreatee65535s64/dev/vgdata/dev/dsk/c0t0d4

vgdisplayvvgdata
Ifyourexpectingtousemorethan16physicaldisksusethepoption,rangefrom1to256disks.
Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
thenewstructuretotheclustertomakeitawareofit.
Todothis:
1.Umountthefilesystemwhichreliesonthelogicalvolumeanddeactivatethevolumegroup:
umount/datavol
vgchangean/dev/vgdata
2.Editthecontrolscriptfileoftheclusterpackagethatwillusethelogicalvolumetoaddthereferencetoit:
vi/etc/cmcluster/package_name/package_name.run

3.Exportthevolumegroupmap:
vgexportpsm/tmp/vgdata.map/dev/vgdata
4.Copymapfileandthepackagecontrolfiletoallnodesbyusingrcporscp:
rcp/etc/cmcluster/package_name/package_name.rungldev:/etc/cmcluster/package_name/
5.Checkandnotetheminornumberingroupfileforthevolumegroup:
lsl/dev/vgdata/group
6.Onthealternatenode,createthecontrolfileusingthesameminornumberoftheprimarynodenotedatstep5(alwaysonthe
alternatenode):
mknod/dev/vgdata/groupc64
7.Importthevolumegrouponthealternatenode:
vgimportsm/tmp/vgdata.map/dev/vgdata
8.Checkwetherthevolumegroupcanbeactivatedonthealternatenode,makeabackupofthevolumegroupconfiguration:
vgchangeay/dev/vgdata
vgcfgbackup/dev/vgdata
9.Onthealternatenode,deactivatethevolumegroupandcheck:
vgchangean/dev/vgdata
vgdisplayvvgdata
Note:Whenavolumegroupiscreatedthemaximumphysicalextentspervolume(max_peparameter)willbesettothemax_pe
ofthelargestphysicalvolume(PV)or1016,whicheverisgreater,ifnomax_peisspecified.
Theeffectofnotspecifyingthemax_peparameteratvolumecreationthroughtheeoptionwouldbethatanyPVaddedtothe
volumegroupinthefutureregardlessoftheirsizewillbelimitedtothevolumegrougcreationvalueofmax_pe.
Therefore,considerincreasingthemax_petoaccommodatePV'sthatmaylikelybelargerthanthelargestPVusedtocreatethe
VolumeGroup.
Theformulatousetodeterminethevalueis:
physical_extent_size*max_pe=size_of_the_disk.
The default value for physical_extent_size is 4M and the maximum value for max_pe is 65535 (example for 18 gig disk use a
value4608formax_pe:4M*4608=18gig).
Thereisalsoadefaultvalueofamaximumof16diskspervolumegroup.
The following is an example of the creation of a volume group modifying these two parameters (max_pe = 4608, maximum
numberofdisk=24):
vgcreatee4608p24/dev/vgdata/dev/dsk/c0t0d4

5.AddingaDisktoaVolumeGroup

Runadiscoveryofthephysicaldisks/LUNs:
ioscanfnCdisk
Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolume
groupinformationsonthedisk:
pvcreatef/dev/rdsk/c0t4d0
vgdisplayv|grepPV
Addthedisktothevolumegroup:
vgextendvg01/dev/dsk/c0t4d0
vgdisplayvvg01

6.RemovingaDiskfromaVolumeGroup

Checkwetherthediskisstillused:
pvdisplay/dev/dsk/c0t4d0
Lookatlinestartingwith"AllocatedPE"thenumberattheendofthelineshouldbe0.Ifitisnotthediskisstillinuse.
Checkthevolumegrouplayout,thenumberofphysicalvolumes(PV)inthevolumegroupandcheckthepresenceofthediskin
thevolume:
vgdisplayvvg01
vgdisplayvvg01|grepPV
vgdisplayvvg01|grepPV|grepc0t4d0
Removediskfromvolumegroupandchecktheresults:
vgreducevg01/dev/dsk/c0t4d0
vgdisplayvvg01|grepPV
vgdisplayvvg01|grepPV|grepc0t4d0
vgdisplayvvg01

7.RemovingaVolumeGroup

Beforeremovingavolumegroup,backupthedataonthevolumesofthevolumegroup.
Identifyallofthelogicalvolumesinthisvolumegroup:
vgdisplayv/dev/vg01
OR:
vgdisplayvvg01|grep"LVName"|awk'{print$3}'
Killtheprocessesusingthevolumesandunmountallofthelogicalvolumeswithacommandsuchasthefollowingrepeatedfor
eachofthevolumesinthevolumegroup:
fuserku/dev/vg01/lvhome
umount/dev/vg01/lvhome
Youcanavoidissuingmanuallytheabovetwocommandsforeachofthevolumesinthevolumegroupbyusingaforloopsuch
asthefollowing(customizeitforyourneeds):
for vol_name in vgdisplay v vg01 | grep "LV Name" | awk '{print $3}' do fuser ku /dev/vg01/$vol_name sleep 2 umount f
$vol_nameechoUmounted$vol_namedone
Checkallofthelogicalvolumesinthevolumegroupareunmounted:
bdf
bdf|grepvg01
Afteryouhavefreedandumountedallofthelogicalvolumes,removethevolumegroupandmakesomecheck:
vgexport/dev/vg01
vgdisplayvvg01
vgdisplayv|grepvg01
vgdisplayv
Note: using vgexport to remove a volume group is easier and faster than using the lvremove on each logical volume,
thevgreduceoneachofthephysicalvolumes(exceptthelastone)andavgremove.
Moreover,anotheradvantageisthatthe/dev/vg01directoryisalsoremoved.
Anyway,fortherightofinformation,thisisthecommonalternativeprocedureyoucanfollowinsteadofusingthevgexport.
Afteryouhavefreedandunmountedallofthelogicalvolumebyusingthefuserandtheumount,issuethefollowingcommands
foreachlogicalvolumeinthevolumegroup:
lvremove/dev/vg01/lvoln
Then,issuethefollowingcommandforeachdiskinthevolumegroup:
vgreduce/dev/vg01/dev/disk/diskn
Youcanavoidissuingmanuallytheabovetwocommandsforeachofthevolumesanddisksinthevolumegroupbyusingafor
loopsuchasthefollowing(customizeitforyourneeds):
forvol_nameinvgdisplayvvg01|grep"LVName"|awk'{print$3}'dolvremove/dev/vg01/$vol_namesleep2echoRemoved
$vol_namedone
for disk_name in `vgdisplay v | grep "PV Name" | cut c 3645` do vgreduce /dev/vg01 /dev/disk/$disk_name sleep 2 echo
Removed$disk_namedone
Finally,removethevolumegroupandmakesomecheck:
vgremovevg01
vgdisplayvvg01
vgdisplayv|grepvg01

vgdisplayv
Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
the new structure to the cluster to make it aware of it.To do this follow the steps about deploying LVM configuration on HP
ServiceGuardClusternodesattheendofthesection"CreatingaVolumeGroup".

8.CreatingaLogicalVolumeandMountingitsFileSystem

Runadiscoveryofthephysicaldisks/LUNs:
ioscanfnCdisk
Createa100GBlogicalvolumelvdata:
lvcreatenlvdataL100000pwvgdata
lvdisplayvlvdata
Createthefilesystem:
newfsFvxfs/dev/vgdata/rlvdata
Createthemountpointandmountthefilesystem:
mkdir/datavol
mount/dev/vgdata/rlvdata/datavol
Ifthevolumeisdedicatedtoaspecificapplication(suchasadatabaseinstanceoranapplicationserverinstance),thentypically
youmayneedtoassignthatmountpointpermissionsaccordingtotheapplication'sneedsandtheownershiptotheapplication's
userandgroup,forexample:
chmod755/datavol
chownoracle:oragroup/datavol
Tohavethefilesystemmountedatsystem'sbootyoumusteditthe/etc/fstabtoaddtheentrycorrespondingtothenewvolume
anditsfilesystem:
vi/etc/fstab
/dev/vgdata/rlvdata/datavolvxfsdefaults02
Ifthesystemonwhichyou'recreatingthelogicalvolumeisanodeofanHPServiceGuardCluster,thenyouhavetopresent
thenewstructuretotheclustertomakeitawareofit.
Todothis:
1.Umountthefilesystemwhichreliesonthelogicalvolumeanddeactivatethevolumegroup:
umount/datavol
vgchangean/dev/vgdata
2.Editthecontrolscriptfileoftheclusterpackagethatwillusethelogicalvolumetoaddthereferencetoit:
vi/etc/cmcluster/package_name/package_name.run

3.Exportthevolumegroupmap:
vgexportpsm/tmp/vgdata.map/dev/vgdata

4.Copymapfileandthepackagecontrolfiletoallnodesbyusingrcporscp:
rcp/etc/cmcluster/package_name/package_name.rungldev:/etc/cmcluster/package_name/
5.Checkandnotetheminornumberingroupfileforthevolumegroup:
lsl/dev/vgdata/group
6.Onthealternatenode,createthecontrolfileusingthesameminornumberoftheprimarynodenotedatstep5(alwaysonthe
alternatenode):
mknod/dev/vgdata/groupc64
7.Importthevolumegrouponthealternatenode:
vgimportsm/tmp/vgdata.map/dev/vgdata
8.Checkwetherthevolumegroupcanbeactivatedonthealternatenode,makeabackupofthevolumegroupconfiguration:
vgchangeay/dev/vgdata
vgcfgbackup/dev/vgdata

9.Alwaysonthealternatenode,createthemountpointdirectoryandassignthepermissionsaccordinglywiththeprimarynode:
mkdir/datavol
chmod755/datavol
chownoracle:oragroup/datavol

10.Mountthefilesytemwhichreliesonthelogicalvolumeonthealternatenode:
mount/dev/vgdata/rlvdata/datavol
bdf
11.Unmountthefilesystem,deactivatethevolumegrouponthealternatenodeandcheck:
umount/datavol
vgchangean/dev/vgdata
vgdisplayvvgdata
Iftheenvironmentusesmirroredindividualdisksinphysicalvolumegroups(PVGs),checkthe/etc/lvmpvgfiletoensurethat
eachphysicalvolumegroupcontainsthecorrectphysicalvolumenamesforthealternatenode.
When you use PVGstrict mirroring, the physical volume group configuration is recorded in the /etc/lvmpvg file on the
configuration node: this file defines the physical volume group swhich at the basis of mirroring and indicates which physical
volumesbelongtoeachphysicalvolumegroup.
Oneachcluster'snode,the/etc/lvmpvgfilemustcontainthecorrectphysicalvolumenamesforthephysicalvolumegroupss
disksastheyareknownonthatnode.
Physicalvolumenamesforthesamediskscouldbedifferentondifferentnodes.
After distributing volume groups to other nodes, make sure each nodes /etc/lvmpvg file correctly reflects the contents of all
physicalvolumegroupsonthatnode.

9.ExtendingaLogicalVolumeanditsFileSystem

Thelogicalvolumeextensionconsistsofextendindthevolumeitselfandthenthefilesystemwhichreliesonit.
Extendalogicalvolumeto200MB:
lvextendL200/dev/vgdata/lvdata
lvdisplayvlvdata
Ifthe"OnlineJFS"packageisnotinstalled,thenfilesystemmustbeunmountedbeforeyoucanextendthefilesystem.
Checkwetherthe"OnlineJFS"packageisinstalled:
swlistlproduct|grepijfs
If the package is not installed, then kill all process that has open files on the volume, check if the volume has been freed,
umountitandcheckifit'sbeenunmounted:
fuserku/dev/vgdata/lvdata
fusercu/dev/vgdata/lvdata
umount/dev/vgdata/lvdata
bdf
If you receive messages telling the volume/filesystem is busy and it cannot be unmounted, then force the unmount by using
theumountfoption:
umountf/dev/vgdata/lvdata
Defragmentthefilesystem(it'soptionalbutagoodpractice):
fsadmdDeE/data
Extendthefilesystemto200MB:
extendfs/data
bdf
Ifthe"OnlineJFS"packageisinstalled,thencalculatethespacetoaddinblocks(200MB/4MB=50LE50x1024=51200
blocks)andperformtheextension:
fsadmFvxfsb51200/data
bdf
Ifyouwanttosetthelargefilesoptionsothefilesystemcansupportfilesgreaterthan2GB,thenyoucandoitalsoaftervolume
creationbyissuingthefollowingcommand:
fsadmFvxfsolargefiles/data
bdf

10.ReducingaLogicalVolumeanditsFileSystem

Beforereducingthevolumebackupthevolumedata.
Toreduce(orshrink)alogicalvolumeinsizeit'snotnecessarytoumountthefilesystem,butthelogicalvolumemustbeunused
becausenotalloftheapplicationsmighthandlethesizereductionwhilethey'reoperating.
Checkifthereareopenfilesonthevolume:
fusercu/dev/vg01/lvol5

Killtheprocessesthathaveopenfilesonthevolume:
fuserku/dev/vg01/lvol5
Reducethelogicalvolumesize:
lvreduceL500/dev/vg01/lvol5
lvdisplayvlvol5
bdf

11.AddingaDisktoaVolumeGroupandCreatingaLogicalVolume

Runadiscoveryofthephysicaldisks/LUNs:
ioscanfnCdisk
Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolume
groupinformationsonthedisk:
pvcreatef/dev/dsk/c0t5d0
Addthedisktothevolumegroupandchecktheresult:
vgextendvg00/dev/dsk/c0t5d0
vgdisplayv|grepPV
vgdisplayvg00
Createthelogicalvolume:
lvcreatenlvdataL100000pw/dev/vg00
Createthefilesystem:
newfsFvxfs/dev/vg00/lvdata
Createthemountpointforthenewfilesystem:
mkdirdatavol
Ifyouwantthenewfilesystemtobemountedatsystemboot,theneditthe/etc/fstabfiletoaddtheentryforthenewlycreated
logicalvolumeanditsfilesystem:
vi/etc/fstab
/dev/vg00/lvdata/datavolvxfsdefaults02
Mountthenewfilesystem:
mounta
Note:thecommandmountamounts all of the filesystems in the /etc/fstab file, so this command is useful to test wether the
newlyaddedentryinthefileissyntacticallyright.Ifyou'resurealloftheentriesinthefilearealreadymountedandthere'sno
"dangerous" entry that must be skipped by mounting but (for any reason) it was not commented out, avoid using the mount a
andissuean"explicit"mountbyspecifyingthenewfilesystemtomount(mountFfs_type/dev/vg00/lvdata/datavol).
Makesomecheck:
bdf
lvdisplay/dev/vg00/lvdata

Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
the new structure to the cluster to make it aware of it.To do this follow the steps about deploying LVM configuration on HP
ServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

12. Adding a Disk, Creating a Volume Group and Creating a Logical


Volume

Runadiscoveryofthephysicaldisks/LUNs:
ioscanfnCdisk
Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolume
groupinformationsonthedisk:
pvcreatef/dev/dsk/c0t5d0
Addthedisktothevolumegroup:
vgextendvg01/dev/dsk/c0t5d0
vgdisplayv|grepPV
Createthestructureforthevolumegroup:
mkdir/dev/vg01
mknod/dev/vg01/groupc640x010000
chownRroot:sys/dev/vg01
chmod755/dev/vg01
chmod640/dev/vg01/group
Createthelogicalvolume:
lvcreatenlvdataL100000pw/dev/vg00
Createthefilesystem:
newfsFvxfs/dev/vg00/lvdata
Createthemountpointforthenewfilesystem:
mkdirdatavol
Ifyouwantthenewfilesystemtobemountedatsystemboot,theneditthe/etc/fstabfiletoaddtheentryforthenewlycreated
logicalvolumeanditsfilesystem:
vi/etc/fstab
/dev/vg00/lvdata/datavolvxfsdefaults02
Mountthenewfilesystem:
mounta
Note:thecommandmountamounts all of the filesystems in the /etc/fstab file, so this command is useful to test wether the
newlyaddedentryinthefileissyntacticallyright.Ifyou'resurealloftheentriesinthefilearealreadymountedandthere'sno
"dangerous" entry that must be skipped by mounting but (for any reason) it was not commented out, avoid using the mount a
andissuean"explicit"mountbyspecifyingthenewfilesystemtomount(mountFfs_type/dev/vg00/lvdata/datavol).

Makesomecheck:
bdf
lvdisplay/dev/vg00/lvdata
Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
the new structure to the cluster to make it aware of it.To do this follow the steps about deploying LVM configuration on HP
ServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

13.AddingaDisktoaVolumeGroupandExtendingaLogicalVolume

Runadiscoveryofthephysicaldisks/LUNs:
ioscanfnCdisk
Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolume
groupinformationsonthedisk:
pvcreatef/dev/dsk/c0t5d0
Addthedisktothevolumegroupandchecktheresults:
vgextendvg01/dev/dsk/c0t5d0
vgdisplayv|grepPV
vgdisplayvg00
Extendthelogicalvolumeandchecktheresults:
lvextendL200000/dev/vg00/lvdata
lvdisplay/dev/vg00/lvdata
bdf

14. Adding a LUN / External Disk, Extending the Volume Group and the
LogicalVolume

DiscoverythenewLUN:
ioscanfnCdisk>/tmp/ioscan1.txt
insfeCdisk
ioscanfnCdisk>/tmp/ioscan2.txt
diff/tmp/ioscan1.txt/tmp/ioscan2.txt
ioscanfnCdisk
RunSAMandcheckfor"unused"hardwarepath:
sam

youwillnoticesomethinglike:
HardwarePathNumberofPathsUseVolumeGroupTotalMBDES
1/10/0/0.115.10.19.98.1.32Unused8192IBM
GettheLUNInfo:
diskinfo/dev/rdsk/c33t1d3
GettheVolumeGroupInfo:
vgdisplayvvg01
AdddisktotheVolumeGroup:
pvcreatef/dev/rdsk/c0t4d0
vgextendvg01/dev/dsk/c0t4d0
vgdisplayvvg01
ORbyUsingSAM:
1)OpenSAM
2)SelectDisksandFileSystems>VolumeGroups
3)Arrowdowntothevolumegroupyouwanttoextend(frombdf)andhitthespacebartoselectit
4)Taboncetogettothemenuatthetopandthenarrowoverto"Actions"andhitenter>5)Select"Extend"fromtheActions
menu
6)Select"SelectDisk(s)..."andhitenter
7)SelecttheappropriatedisktoaddwiththespacebarandselectOK,thenSelectOKwhichwillexpandthevolum
8)ExitSAM
ChecktheFileSystemMountedontheLogicalVolumetoExtendandTakeNoteoftheSpaceInfo(kbytesusedavail%used):
bdf/oradata
ExtendtheLogicalVolume:
lvextendL11776/dev/vg01/lvol3
DefragmenttheFileSystemMountedontheLogicalVolume:
fsadmdDeE/oradata
ExtendtheFileSystemMountedontheLogicalVolume:
fsadmFvxfsb11776M/oradata
ChecktheFileSystemInfotoVerifytheCurrentSpace:
bdf/oradata

15.ImportingandExportingVolumeGroups

1)Makethevolumegroupunavailablebydisactivatingit:
vgchangean/dev/vgdata
2)Exportthethediskwhilecreatingalogicalvolumemapfile:
vgexportvmdata_mapvgdata

3)Disconnectthedrivesandmovetonewsystem.
4)Movethedata_mapfiletothenewsystem.
5)Onthenewsystemrecreatethevolumegroupdirectory:
mkdir/dev/vgdata
mknod/dev/vgdata/groupc640x010000
chownRroot:sys/dev/vgdata
chmod755/dev/vgdata
chmod640/dev/vgdata/group
6)Importthediskstothenewsystem:
vgimportvmdata_map/dev/vgdata/dev/dsk/c2t1d0/dev/dsk/c2t2d0
7)Enablethenewvolumegroup:
vgchangeay/dev/vgdata

16.RemovingaLogicalVolume

Beforeremovingthelogicalvolumebackupthevolumedata.
Checkwetherprocesseshasopenfilesonthelogicalvolume:
fusercu/dev/vgdata/lvdata
Asthevolumehasbeenfreed,umountitandcheckifit'sbeenunmounted:
fuserku/dev/vgdata/lvdata
fusercu/dev/vgdata/lvdata
umount/dev/vgdata/lvdata
bdf
If you receive messages telling the volume/filesystem is busy and it cannot be unmounted, then force the unmount by using
theumountfoption:
umountf/dev/vgdata/lvdata
Removethelogicalvolume:
lvremove/dev/vgdata/lvdata
Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
the new structure to the cluster to make it aware of it.To do this follow the steps about deploying LVM configuration on HP
ServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

17. Moving Disks Within a System (LVM Configuration with Persistent


DeviceFiles)

Deactivatethevolumegroup:
vgchangean/dev/vgnn
Physicallymoveyourdiskstotheirdesirednewlocations.
Activatethevolumegroup:
vgchangeay/dev/vgnn

18.MovingDisksWithinaSystem(LVMConfigurationwithLegacyDevice
Files)

Deactivatethevolumegroup:
vgchangean/dev/vgnn
Ifyouwanttoretainthesameminornumberforthevolumegroup,examinethevolumegroup'sgroupfile:
lsl/dev/vgnn/group
RemovethevolumegroupdevicefilesanditsentryfromtheLVMconfigurationfiles:
vgexportvsm/tmp/vgnn.map/dev/vgnn
Physicallymoveyourdiskstotheirdesirednewlocations.
Toviewthenewlocations:
vgscanv
If you want to retain the minor number of the volume group device file, create it (the group file in this example has a major
numberof64andaminornumberof0x01000000):
mkdir/dev/vgnn
mknod/dev/vgnn/groupc640x010000
AddthevolumegroupentrybacktotheLVMconfigurationfiles:
vgimportvsm/tmp/vgnn.map/dev/vgnn
Activatethenewlyimportedvolumegroup:
vgchangeay/dev/vgnn
Backupthevolumegroupconfiguration:
vgcfgbackup/dev/vgnn

19.MovingDisksBetweenSystems

Makethevolumegroupanditsassociatedlogicalvolumesunavailabletousers:
vgchangean/dev/vg_planning
PreviewtheremovalofthevolumegroupinformationfromtheLVMconfigurationfiles:
vgexportpvsm/tmp/vg_planning.map/dev/vg_planning
Removethevolumegroupinformation:
vgexportvsm/tmp/vg_planning.map/dev/vg_planning
Connectthediskstothenewsystemandcopythe/tmp/vg_planning.mapfiletothenewsystem.
CreatethevolumegroupDeviceFiles:
mkdir/dev/vg_planning
mknod/dev/vg_planning/groupc640x010000
chownRroot:sys/dev/vg_planning
chmod755/dev/vg_planning
chmod640/dev/vg_planning/group
Getdevicefileinformationaboutthedisks:
ioscanfunNCdisk
Importthevolumegroup:
vgimportNvsm/tmp/vg_planning.map/dev/vg_planning
Activatethenewlyimportedvolumegroup:
vgchangeay/dev/vg_planning

20.MovingDatatoaDifferentPhysicalVolume
Tomovethedatainlogicalvolume/dev/vg01/marketsfromthedisk/dev/disk/disk4tothedisk/dev/disk/disk7:
pvmoven/dev/vg01/markets/dev/disk/disk4/dev/disk/disk7
Tomovealldataoffdisk/dev/dsk/disk3andrelocateitatthedestinationdisk/dev/disk/disk5:
pvmove/dev/disk/disk3/dev/disk/disk5
Tomovealldataoffdisk/dev/disk/disk3andletLVMtransferthedatatoavailablespacewithinthevolumegroup:
pvmove/dev/disk/disk3

21.ReplacingaMirroredNonBootDisk

Takenoteofthehardwarepathstothedisk:
ioscanmlun/dev/disk/disk14
HaltLVMaccesstothedisk
Ifthediskisnothotswappable,poweroffthesystemtoreplaceit.
Ifthediskishotswappable,detachit:
pvchangeaN/dev/disk/disk14
PhysicallyReplacethedisk.
Ifthesystemwasnotrebooted,Notifythemassstoragesubsystemthatthediskhasbeenreplaced:
scsimgrreplace_wwidD/dev/rdisk/disk14
DeterminethenewLUNinstancenumberforthereplacementdisk:
ioscanmlun
Inthisexample,LUNinstance28wascreatedforthenewdisk,withLUNhardwarepath64000/0xfa00/0x1c,devicespecialfiles
/dev/disk/disk28 and /dev/rdisk/disk28, at the same lunpath hardware path as the old disk, 0/1/1/1.0x3.0x0. The old LUN
instance14fortheolddisknowhasnolunpathassociatedwithit.
Ifthesystemwasrebootedtoreplacethefaileddisk,thenioscanmlundoesnotdisplaytheolddisk.
Assigntheoldinstancenumbertothereplacementdisk(thisassignstheoldLUNinstancenumber14tothereplacementdisk
andthedevicespecialfilesforthenewdiskarerenamedtobeconsistentwiththeoldLUNinstancenumber):
io_redirect_dsfd/dev/disk/disk14n/dev/disk/disk28
ioscanmlun/dev/disk/disk14
RestoreLVMconfigurationinformationtothenewdisk:
vgcfgrestoren/dev/vgnn/dev/rdisk/disk14
RestoreLVMaccesstothedisk(ifthediskishotswappable):
pvchangeay/dev/disk/disk14
Ifthediskisnothotswappableandyouhadrebootthesystem,reattachthediskbyreactivatingthevolumegroupasfollows:
vgchangeay/dev/vgnn

22.ReplacinganUnirroredNonBootDisk

Takenoteofthehardwarepathstothedisk:
ioscanmlun/dev/disk/disk14
HaltLVMaccesstothedisk
Ifthediskisnothotswappable,poweroffthesystemtoreplaceit.
Ifthediskishotswappable,disableuserandLVMaccesstoallunmirroredlogicalvolumes.

Foreachunmirroredlogicalvolumeusingthediskkillalloftheprocessesaccessingthevolume:
fusercudev/vg01/lvol1
fuserkudev/vg01/lvol1
umount/dev/vg01/lvol1
DisableLVMaccesstothedisk:
pvchangeaN/dev/disk/disk14
PhysicallyReplacethedisk.
Ifthesystemwasnotrebooted,Notifythemassstoragesubsystemthatthediskhasbeenreplaced:
scsimgrreplace_wwidD/dev/rdisk/disk14
DeterminethenewLUNinstancenumberforthereplacementdisk:
ioscanmlun
Assigntheoldinstancenumbertothereplacementdisk(thisassignstheoldLUNinstancenumber14tothereplacementdisk
andthedevicespecialfilesforthenewdiskarerenamedtobeconsistentwiththeoldLUNinstancenumber):
io_redirect_dsfd/dev/disk/disk14n/dev/disk/disk28
ioscanmlun/dev/disk/disk14
RestoreLVMconfigurationinformationtothenewdisk:
vgcfgrestoren/dev/vgnn/dev/rdisk/disk14
RestoreLVMaccesstothedisk(ifthediskishotswappable):
pvchangeay/dev/disk/disk14
Ifthediskisnothotswappableandyouhadrebootthesystem,reattachthediskbyreactivatingthevolumegroupasfollows:
vgchangeay/dev/vgnn
Recoveranylostdata:
LVMrecoversallthemirroredlogicalvolumesonthedisk,andstartsthatrecoverywhenthevolumegroupisactivated.
ForalltheunmirroredlogicalvolumesthatyouidentifiedinStep2,restorethedatafrombackupandreenableuseraccess.
Forrawvolumes,restorethefullrawvolumeusingtheutilitythatwasusedtocreateyourbackup.Thenrestarttheapplication.
Forfilesystems,youmustrecreatethefilesystemsfirst:
newfsFfstype/dev/vgnn/rlvolnn

23.ReplacingaMirroredBootDisk

Takenoteofthehardwarepathstothedisk:
ioscanmlun/dev/disk/disk14
HaltLVMaccesstothedisk
Ifthediskisnothotswappable,poweroffthesystemtoreplaceit.
Ifthediskishotswappable,detachit:
pvchangeaN/dev/disk/disk14
PhysicallyReplacethedisk.

Ifthesystemwasnotrebooted,Notifythemassstoragesubsystemthatthediskhasbeenreplaced:
scsimgrreplace_wwidD/dev/rdisk/disk14
DeterminethenewLUNinstancenumberforthereplacementdisk:
ioscanmlun
Inthisexample,LUNinstance28wascreatedforthenewdisk,withLUNhardwarepath64000/0xfa00/0x1c,devicespecialfiles
/dev/disk/disk28 and /dev/rdisk/disk28, at the same lunpath hardware path as the old disk, 0/1/1/1.0x3.0x0. The old LUN
instance14fortheolddisknowhasnolunpathassociatedwithit.
Ifthesystemwasrebootedtoreplacethefaileddisk,thenioscanmlundoesnotdisplaytheolddisk.
Assigntheoldinstancenumbertothereplacementdisk(thisassignstheoldLUNinstancenumber14tothereplacementdisk
andthedevicespecialfilesforthenewdiskarerenamedtobeconsistentwiththeoldLUNinstancenumber):
io_redirect_dsfd/dev/disk/disk14n/dev/disk/disk28
ioscanmlun/dev/disk/disk14
RestoreLVMconfigurationinformationtothenewdisk:
vgcfgrestoren/dev/vgnn/dev/rdisk/disk14
RestoreLVMaccesstothedisk(ifthediskishotswappable):
pvchangeay/dev/disk/disk14
Ifthediskisnothotswappableandyouhadrebootthesystem,reattachthediskbyreactivatingthevolumegroupasfollows:
vgchangeay/dev/vgnn
Initializebootinformationonthedisk:
lvlnbootv
lvlnbootR/dev/vg00
lvlnbootv

24.CreatingaSpareDisk

InitializethediskasanLVMdisk:
pvcreate/dev/rdisk/disk3
Ensurethevolumegrouphasbeenactivated:
vgchangeay/dev/vg01
Designateoneormorephysicalvolumesassparephysicalvolumeswithinthevolumegroup:
vgextendzy/dev/vg01/dev/disk/disk3
Alternately,youcanchangeaphysicalvolumewithnoextentscurrentlyallocatedwithinitintoasparephysicalvolume:
pvchangezy/dev/disk/disk3

25.ReinstatingaSpareDisk

Afterafaileddiskhasbeenrepairedoradecisionhasbeenmadetoreplaceit,followthesestepstoreinstateitandreturnthe
sparedisktoitsformerstandbystatus.
Physicallyconnecttheneworrepaireddisk.
RestoretheLVMconfiguration:
vgcfgrestoren/dev/vg01/dev/rdisk/disk1
Ensurethevolumegrouphasbeenactivated:
vgchangeay/dev/vg01
Besurethatallocationofextentsisnowallowedonthereplaceddisk:
pvchangexy/dev/disk/disk1
Movethedatafromthesparetothereplacedphysicalvolume:
pvmove/dev/disk/disk3/dev/disk/disk1
Thedatafromthesparediskisnowbackontheoriginaldiskoritsreplacement,andthesparediskisreturnedtoitsroleasa
standbyemptydisk.

26.ChangingPhysicalVolumeBootTypes

Tochangeadisktypefrombootabletononbootable,followthesesteps:
Usevgcfgrestoretodetermineifthevolumegroupcontainsanybootabledisks:
vgcfgrestorelvnvg01
Runvgmodifytwice,oncewiththeBnandoncewithoutit.Comparetheavailablevaluesformax_peandmax_pv:
vgmodifytBnvg01/dev/rdsk/c2t1d0
vgmodifytvg01
Choosenewvaluesformax_peandmax_pv.Reviewthevaluesbyrunningvgmodifywiththenewsettingsandtheroption:
vgmodifyrp6e56828Bnvg01/dev/rdsk/c2t1d0
Deactivatethevolumegroup:
vgchangeanvg01
Committhechangesbyrunningvgmodifywithouttheroption:
vgmodifyp6e56828Bnvg01/dev/rdsk/c2t1d0
Activatethevolumegroup:

vgchangeayvg01
Runthevgcfgrestoreorpvdisplaycommandstoverifythatthedisktypehaschanged:
vgcfgbackupvg01
vgcfgrestorelvnvg01

27.EnablingandDisablingaPathtoaPhysicalVolume

Todetachalinktoaphysicalvolume:
pvchangean/dev/disk/disk33
If you are using LVM's alternate links for multipathed disks, each link uses a different legacy device files. In that situation, to
detachalllinkstoaphysicalvolume,useNastheargumenttotheaoption:
pvchangeaN/dev/dsk/c5t0d0
Toreattachaspecificpathtoaphysicalvolume:
pvchangeay/dev/dsk/c5t0d0
Because detaching a link to a physical volume is temporary, all detached links in a volume group are reattached when the
volumegroupisactivated,eitheratboottimeorwithanexplicitvgchangecommand:
vgchangeay/dev/vg02

28.CreatinganAlternateBootDisk

WithnonLVMdisks,asinglerootdiskcontainsalltheattributesneededforboot,systemfiles,primaryswap,anddump.Using
LVM,asinglerootdiskisreplacedbyapoolofdisks,arootvolumegroup,whichcontainsallofthesameelementsbutallowing
a root logical volume, a boot logical volume, a swap logical volume, and one or more dump logical volumes. Each of these
logicalvolumesmustbecontiguous,thatis,containedonasingledisk,andtheymusthavebadblockrelocationdisabled.
If you newly install your HPUX system and choose the LVM configuration, a root volume group is automatically configured
(/dev/vg00),asareseparateroot(/dev/vg00/lvol3)andboot(/dev/vg00/lvol1)logicalvolumes.Ifyoucurrentlyhaveacombined
root and boot logical volume and you want to reconfigure to separate them after creating the boot logical volume, use
thelvlnbootcommandwiththeboptiontodefinethebootlogicalvolumetothesystem,takingeffectthenexttimethesystem
isbooted.
Ifyoucreateyourrootvolumegroupwithmultipledisks,usethelvextendcommandtoplacetheboot,root,andprimaryswap
logicalvolumesonthebootdisk.
You can use pvmove to move the data from an existing logical volume to another disk if necessary to make room for the root
logicalvolume.

Createabootablephysicalvolume:
OnanHPIntegrityserver,partitionthediskusingtheidiskcommandandapartitiondescriptionfile,thenruninsf.
RunpvcreatewiththeBoption.
OnanHPIntegrityserver,usethedevicefiledenotingtheHPUXpartition:
pvcreateB/dev/rdisk/disk6_p2
OnanHP9000server,usethedevicefilefortheentiredisk:
pvcreateB/dev/rdisk/disk6
Createadirectoryforthevolumegroup:
mkdir/dev/vgroot
mknod/dev/vgroot/groupc640xnn0000
Createtherootvolumegroup,specifyingeachphysicalvolumetobeincluded:
vgcreate/dev/vgroot/dev/disk/disk6
Placebootutilitiesinthebootarea:
mkboot/dev/rdisk/disk6
Addanautobootfiletothediskbootarea:
mkboota"hpux"/dev/rdisk/disk6
Createthebootlogicalvolume:
lvcreateCyrnnbootlv/dev/vgroot#lvextendL512/dev/vgroot/bootlv/dev/disk/disk6
Createtheprimaryswaplogicalvolume:
lvcreateCyrnnswaplv/dev/vgroot#lvextendL2048/dev/vgroot/swaplv/dev/disk/disk6
Createtherootlogicalvolume:
lvcreateCyrnnrootlv/dev/vgroot#lvextendL1024/dev/vgroot/rootlv/dev/disk/disk6
Specifythatbootlvisthebootlogicalvolume:
lvlnbootb/dev/vgroot/bootlv
Specifythatrootlvistherootlogicalvolume:
lvlnbootr/dev/vgroot/rootlv
Specifythatswaplvistheprimaryswaplogicalvolume:
lvlnboots/dev/vgroot/swaplv
Specifythatswaplv:
lvlnbootd/dev/vgroot/swaplv
Verifytheconfiguration:
lvlnbootv/dev/vgroot
Oncethebootandrootlogicalvolumesarecreated,createfilesystemsforthem:
mkfsFhfs/dev/vgroot/rbootlv
OR
mkfsFvxfs/dev/vgroot/rrootlv
OnHPIntegrityservers,thebootfilesystemcanbeVxFS:

mkfsFvxfs/dev/vgroot/rbootlv

29.MirroringtheBootDisk

Afteryoucreatemirrorcopiesoftheroot,boot,andprimaryswaplogicalvolumes,ifanyoftheunderlyingphysicalvolumesfail,
thesystemcanusethemirrorcopyontheotherdiskandcontinue.Whenthefaileddiskcomesbackonline,itisautomatically
recovered,providedthesystemhasnotbeenrebooted.
Ifthesystemrebootsbeforethediskisbackonline,reactivatethevolumegrouptoupdatetheLVMdatastructuresthattrack
thediskswithinthevolumegroup.Youcanusevgchangeayeventhoughthevolumegroupisalreadyactive.
Toreactivatevolumegroupvg00:
vgchangeay/dev/vg00
Asaresult,LVMscansandactivatesallavailabledisksinthevolumegroupvg00,includingthediskthatcameonlineafterthe
systemrebooted.
TheprocedureforcreatingamirrorofthebootdiskisdifferentforHP9000andHPIntegrityservers.HPIntegrityserversuse
partitionedbootdisks.

30.MirroringtheBootDiskonHP9000Servers

Makesurethedevicefilesareinplace:
insfeH0/1/1/0.0x1.0x0
Createabootablephysicalvolume:
pvcreateB/dev/rdisk/disk4
Addthephysicalvolumetoyourexistingrootvolumegroup:
vgextend/dev/vg00/dev/disk/disk4
Placebootutilitiesinthebootarea:
mkboot/dev/rdisk/disk4
Addanautobootfiletothediskbootarea:
mkboota"hpux"/dev/rdisk/disk4
The logical volumes on the mirror boot disk must be extended in the same order that they are configured on the original boot
disk.Determinethelistoflogicalvolumesintherootvolumegroupandtheirorder:
pvdisplayv/dev/disk/disk0|grep'current.*0000$'

Mirroreachlogicalvolumeinvg00(therootvolumegroup)ontothespecifiedphysicalvolume:
lvextendm1/dev/vg00/lvol1/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol2/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol3/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol4/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol5/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol6/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol7/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol8/dev/disk/disk2_p2
lvsyncT/dev/vg00/lvol*
Updatetherootvolumegroupinformation:
lvlnbootR/dev/vg00
lvlnbootv
Specifythemirrordiskasthealternatebootpathinnonvolatilememory:
setboota0/1/1/0.0x1.0x0
Addalineto/stand/bootconfforthenewbootdisk:
vi/stand/bootconfl/dev/disk/disk4

31.MirroringtheBootDiskonHPIntegrityServers

CreateaPartitionDescriptionFile:
vi/tmp/idf
Partitionthedisk:
idiskf/tmp/idfw/dev/rdisk/disk2
Checkthepartitionslayout:
idisk/dev/rdisk/disk2
Createthedevicefilesforallthepartitions:
insfeH0/1/1/0.0x1.0x0
CreateabootablephysicalvolumeusingthedevicefiledenotingtheHPUXpartition:
pvcreateB/dev/rdisk/disk2_p2
Addthephysicalvolumetoyourexistingrootvolumegroup:
vgextendvg00/dev/disk/disk2_p2
Placebootutilitiesinthebootarea.CopyEFIutilitiestotheEFIpartition,andusethedevicespecialfilefortheentiredisk:
mkbootel/dev/rdisk/disk2
Addanautobootfiletothediskbootarea:
mkboota"hpux"/dev/rdisk/disk2
The logical volumes on the mirror boot disk must be extended in the same order that they are configured on the original boot

disk.Determinethelistoflogicalvolumesintherootvolumegroupandtheirorder:
pvdisplayv/dev/disk/disk0_p2|grep'current.*0000$'
Mirroreachlogicalvolumeinvg00(therootvolumegroup)ontothespecifiedphysicalvolume:
lvextendm1/dev/vg00/lvol1/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol2/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol3/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol4/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol5/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol6/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol7/dev/disk/disk2_p2
lvextendm1/dev/vg00/lvol8/dev/disk/disk2_p2
lvsyncT/dev/vg00/lvol*
Iflvextendfailswiththemessage"m:illegaloptionHPMirrorDisk/UXisnotinstalled".
Updatetherootvolumegroupinformation:
lvlnbootR/dev/vg00
lvlnbootv
Specifythemirrordiskasthealternatebootpathinnonvolatilememory:
setboota0/1/1/0.0x1.0x0
Addalineto/stand/bootconfforthenewbootdisk:
vi/stand/bootconfl/dev/disk/disk2_p2

32.BackingUpaMirroredLogicalVolume

You can split a mirrored logical volume into two logical volumes to perform a backup on an offline copy while the other copy
staysonline.Whenyoucompletethebackupoftheofflinecopy,youcanmergethetwologicalvolumesbackintoone.Tobring
the two copies back in synchronization, LVM updates the physical extents in the offline copy based on changes made to the
copythatremainedinuse.
YoucanuseHPSMHtosplitandmergelogicalvolumes,orusethelvsplitandlvmergecommands.
Tobackupamirroredlogicalvolumecontainingafilesystem,usinglvsplitandlvmerge,followthesesteps:
Splitthelogicalvolume/dev/vg00/lvol1intotwoseparatelogicalvolumes:
lvsplit/dev/vg00/lvol1
Performafilesystemconsistencycheckonthelogicalvolumetobebackedup:
fsck/dev/vg00/lvol1b
Mountthefilesystem:
mkdir/backup_dir
mount/dev/vg00/lvol1b/backup_dir
Performthebackup.

Unmountthefilesystem:
umount/backup_dir
Mergethesplitlogicalvolumebackwiththeoriginallogicalvolume:
lvmerge/dev/vg00/lvol1b/dev/vg00/lvol1

33.BackingUpandRestoringVolumeGroupConfiguration

If you back up your volume group configuration, you can restore a corrupted or lost LVM configuration in the event of a disk
failureorcorruptionofyourLVMconfigurationinformation.
Itisimportantthatvolumegroupconfigurationinformationbesavedwheneveryoumakeanychangetotheconfigurationsuchas
adding or removing disks to a volume group, changing the disks in a root volume group, creating or removing logical volumes,
extendingorreducinglogicalvolumes,etc...
Bydefault,vgcfgbackupsavestheconfigurationofavolumegrouptothefile/etc/lvmconf/volume_group_name.conf.
BackupConfiguration:
vgcfgbackupfpathname/filenamevolume_group_name
Torunvgcfgrestore,thephysicalvolumemustbedetached.
RestoreConfiguration(usingthedefaultbackupfile/etc/lvmconf/vgsales.conf):
pvchangean/dev/disk/disk5
vgcfgrestoren/dev/vgsales/dev/rdisk/disk5
pvchangeay/dev/disk/disk5
Ifthephysicalvolumeisnotmirroredorthemirrorcopiesarenotcurrentandavailable,youmustdeactivatethevolumegroup
withvgchange,performthevgcfgrestore,andactivatethevolumegroup:
vgchangean/dev/vgsales
vgcfgrestoren/dev/vgsales/dev/rdisk/disk5
vgchangeay/dev/vgsales

34.QuiescingandResumingaVolumeGroup

Ifyouplantouseadiskmanagementutilitytocreateabackupimageorsnapshotofallthedisksinavolumegroup,youmust
make sure that LVM is not writing to any of the disks when the snapshot is being taken otherwise, some disks can contain
partiallywrittenorinconsistentLVMmetadata.
Tokeepthevolumegroupdiskimageinaconsistentstate,youmusteitherdeactivatethevolumegrouporquiesceit.

Deactivatingthevolumegrouprequiresyoutocloseallthelogicalvolumesinthevolumegroup,whichcanbedisruptive.
Quiescingthevolumegroupenablesyoutokeepthevolumegroupactivatedandthelogicalvolumesopenduringthesnapshot
operation,minimizingtheimpacttoyoursystem.
Youcanquiescebothreadandwriteoperationstothevolumegroup,orjustwriteoperations.
Whileavolumegroupisquiesced,thevgdisplaycommandreportsthevolumegroupaccessmodeasquiesced.
The indicated I/O operations queue until the volume group is resumed, and commands that modify the volume group
configurationfailimmediately.
Bydefault,thevolumegroupremainsquiesceduntilitisexplicitlyresumed.
Youcanspecifyamaximumquiescetimeinsecondsusingthetoptionofthevgchangecommand:ifthequiescetimeexpires,
thevolumegroupisresumedautomatically.
ThevgchangeQoptionindicatesthequiescingmode,whichcanberw.
Toquiesceavolumegroupforamaximumoftenminutes(600seconds):
vgchangeQwt600vg08
Toresumeaquiescedvolumegroup:
vgchangeRvg08

35.AddingaMirrortoaLogicalVolume

Addamirrorcopytoalogicalvolume:
lvextendm1/dev/vg00/lvol1
Addamirrorcopytoalogicalvolumeforcingitontoaspecifiedphysicaldisk:
lvextendm1/dev/vg00/lvol1/dev/disk/disk4

36.RemovingaMirrorfromaLogicalVolume

Toremovemirrorcopiesreducingitto0copies:
lvreducem0/dev/vg00/lvol1
Toremovemirrorcopiesreducingitto1copy:
lvreducem1/dev/vg00/lvol1
Toremovethemirrorcopyfromaspecificdiskreducingitto0copies:
lvreducem0/dev/vg00/lvol1/dev/disk/disk4

37.IncreasingthePrimarySwap

Becauseofthecontiguousallocationpolicy,youcannotextendtheswaplogicalvolume:sotoincreasetheprimaryswapyou
createabiggerlogicalvolumeandmodifytheBootDataReservedArea(BDRA)tomakeitprimary.
Createthelogicalvolumeonthevolumegroupvg00:
lvcreateCyL240/dev/vg00
Asthenameofthisnewlogicalvolumewillbedisplayedonthescreen,noteit:itwillbeneededlater.
Toeasetheexample,we'llassumenowthenameofthenewvolumeis/dev/vg00/lvol8.
Displaythecurrentrootandswaplogicalvolumes(lvol2isthedefaultprimaryswap):
lvlnbootv/dev/vg00
Specifylvol8istheprimaryswaplogicalvolume:
lvlnboots/dev/vg00/lvol8/dev/vg00
RecoveranymissinglinkstoallofthelogicalvolumesintheBDRAandupdatetheBDRAofeachbootablephysicalvolumein
thevolumegroup.
Updatetherootvolumegroupinformation:
lvlnbootR/dev/vg00
Rebootthesystem:
init6

38.IdentifyingAvailableDiskstobeUsedinaVolumeGroup

Listthedisks/LUNs:
ioscanfunCdisk
Someofthedevicesyouseeintheoutputoftheprevioscommandwillbeallocated,somewillnot.
Listallofthephysicalvolumedandtheirdevicesforalloftheexistingvolumegroups:
vgdisplayv
vgdisplayv|grepPV
Thisisalistofthedevicesthatareinuse(astheyarepartofavolumegroup).
Now,comparethetwooutputs:anydevicethat'sintheioscanoutput,butNOTinthevgdisplayoutputareavailableforuse.
Youcanautomatethisprocessbyusingsed,awkandgrep.
1.Createafile(herenamedwte_hitachi_disk)listingallofthedisksthatcanbeused(inthisexampleHITACHI):

ioscanfnCdisk>>wte_disk_ioscan
cat wte_disk_ioscan | sed 1,2d | grep v e TOSHIBA e c2t0d0 | xargs n 10 | grep HITACHI | grep vi subsystem >>
wte_hitachi_disk

1.
2.
3.
4.
5.
6.
7.

CreateafilecontainingtheioscanfnCdiskoutput
catwilloutputthefilecontainingthediskioscan
seddeletesthefirst2headerlinesofthefile
grepprintsoutanylinesthatDONOTincludeTOSHIBAorc2t0d0
xargsgroupstheoutputintogroupsof10
NextgrepfindsallofthelineswithHITACHIinthem
AllofthelinesthathaveHITACHIinthemaresavedtothefilewte_hitachi_disk

2. Refine the ioscan of HITACHI disks to include just the disk devices, sorted this is a list of all HITACHI disks on the
system:
awk'{print$9}'wte_hitachi_disk|sortu>wte_hitachi_sorted_u

1. awkprintsjustthe9thfieldofthefile
2. sortusortsthefileandsurpressesanyduplicates
3. Thisissavedtothesortedfilewte_hitachi_sorted_u.
Printalistofallthedisksthatarecurrentlybeingused(alistofPVs):
vgdisplayv|grep"PVName">wte_pvdisk_used

1. vgdisplayvprintsaverboselistingofallvolumegroups
2. greponlyprintslinesthatcontainPVName
3. ThelistofPVsissavedtothefilewte_pvdisk_used.
Refinethelistofdisksthatarebeingused:
awk'{print$3}'wte_pvdisk_used|sortu>wte_pvdisk_sorted_u

1. awkprintsonthe3rdfield(thediskdevice)
2. sortsortsthelist,surpressinganyduplicateentries
3. Theresultsaresavedtothefilewte_pvdisk_sorted_u.
ComparethetwofilesthelistofalltheHitachidisksonthesystemwiththelistofalldisksbeingused:
diffwte_hitachi_sorted_uwte_pvdisk_sorted_u

1. diffcomparesthetwofilesandprintsoutanydifferences.Thedifferencewillbeoneormoredisksthatthesystemsees,
butthatarenotbeingusedbyLVM.

39.CreatingaPhysicalVolumeGroup(PVG)

ImagineanSC10rackwith2controllers.Someofthedisksareon1controller,someonthecontroller2.Forhighavailabilityyou
would want a logical volume to be created on a disk that is on one controller and mirrored on a disk that is on another
controller.However,theconceptof"controller"isunknowninLVM.

HencePVG's.
Youcreateoneforthedisksononecontroller,anotheroneforthedisksontheothercontroller,thenyoumakelogicalvolumes
PVGstrict(lvchangesg...).
PVGsincreasenotonlyI/Ohighavailabilitybutalsoperformance.
By using PVGs physical volumes can be grouped by controllers: then logical volumes can be created on different PVGs. This
wayPVGsallowtoknowwhereeachdiskisandwhatchannelstomirrordown,sowithcarefulplanninganddiligentuseofthe
LVMcommandsyoucanensureI/OseparationwithoutusingLVM.

Description:raphics/06fig01.jpg

Youcanusetwomirroringtypes.
Cleanmirror:
WhencreatingthevolumegroupyouwouldsetitupbyputtingAandBinPVG1,andCandDinPVG2:youdothisbyusing"
g" option in volume group creation to define the PVG name. When creating logical volumes you may to mirror (for example) 1
copy, you can put the mirrored copy in a separate PVG so that your mirrored copies are always in PVG2, for example. This
would help in disaster recovery situation. Thelvcreatecommand has "sg" option to setup a PVGstrict mirror. To extend a
logicalvolumeyouissueastraightforwardlvextendsinceitwasalreadydefinedasPVGstrict.
Dirtymirror:
Thevolumegroupissetupinanormalmanner.Whencreatinglogicalvolumes,ifyousetuptomirror1copyanddonotspecify
toLVMwheretoputitsmirroredcopythenyoumayendupinasiuationwherebythemirroredcopycanresideanywhereinA,B,
C,D,evenonthediskwheretheprimarycopyresides.Soyoucanactuallyinstructlvextendtoputthemirrorcopyonaspecific
disk,butthenyouwouldhavetokeeptrackofthePEs,etc...IfPVGissetupthisisdoneautomatically.
Tocreateaphysicalvolumegroup(PVG)createafilenamed/etc/lvmpvgwiththefollowingsyntax:
VGvg_name
PVGpvg_name
pv_path
...
PVGpvg_name
pv_path
...
VGvg_name
PVGpvg_name
pv_path
[...]
Forexample,tousetwoPVGsinvg01withc1t6d0andc2t6d0inonePVG(PVG0),c3t6d0andc4t6d0intheotherPVG(PVG1)
thecontentsofthefile/etc/lvmpvgshouldbe:
VG/dev/vg01
PVGPVG0
/dev/dsk/c1t6d0
/dev/dsk/c2t6d0
PVGPVG1
/dev/dsk/c3t6d0
/dev/dsk/c4t6d0

Thencreatethephysicalvolumegroups:
vgcreategpvg1/dev/vgname/dev/dsk/c5t8d0/dev/dsk/c5t9d0
vgextendgpvg2/dev/vgname/dev/dsk/c7t1d0/dev/dsk/c7t2d0
vgdisplayvvgname
Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
the new structure to the cluster to make it aware of it.To do this follow the steps about deploying LVM configuration on HP
ServiceGuardClusternodesattheendofthesection"CreatingaVolumeGroup".

40.Creating(Mirroring)LogicalVolumesonSpecificPhysicalVolumes

Aftercreatingthe/etc/lvmpvgfileasdescribeaboveintheprevioussection,eachcopyofthemirroryoucreatecouldbeforceon
differentPVG.
Tocreatealogicalvolumeinthephysicalvolumegroup:
lvcreatem1nvolume_nameLsize_in_mbsg/dev/pvg_name
lvdisplayvlvhome
To create a RAID 0 + 1 you need at least two disks in each PVG, then you use the "s g & D Y" options of
thelvcreatecommandduringthelogicalvolumecreation.
Ifthelogicalvolumeisalreadycreatedbutnotmirroredyet,issuethefollowingcommand:
lvchangesg/dev/vg01/lvhome
lvextendm1/dev/vg01/lvhome
lvdisplayvlvhome
Ifthesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster,thenyouhavetopresent
the new structure to the cluster to make it aware of it.To do this follow the steps about deploying LVM configuration on HP
ServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

Vous aimerez peut-être aussi