hp-ux lvm, disk and filesystem tasks

31
 Table of Contents 1. Basic Tasks....................................................................................................................................................... ................. 1 2. Recognizing and Initializing in LVM a newly added Disk / LUN (Discovery / Rescan)  2 3. Removing a Physical Volume...................... ...................... ...................... ..................... ...................... .................... 2 4. Creating a Volume Group.................... ...................... ..................... ...................... ...................... ...................... ........ 3 5. Adding a Disk to a Volume Group................... ...................... ...................... ..................... ...................... ............ 4 6. Removing a Disk from a Volume Group.................... ..................... ...................... ...................... .................... 5 7. Removing a Volume Group.................... ..................... ...................... ...................... ...................... ...................... ..... 5 8. Creating a Logical Volume and Mounting its File System ................... ...................... ...................... ... 6 9. Extending a Logical Volume and its FileSystem..................................................................................... .. 8 10. Reducing a Logical Volume and its FileSystem ................................................................. .................... 9 11. Adding a Disk to a Volume Group and Creating a Logical Volume ......................................... 9 12. Adding a Disk, Creating a Volume Group and Creating a Logical Volume .................... . 10 13. Adding a Disk to a Volume Group and Extending a Logical Volume .................... .............. 11 14. Adding a LUN / External Disk, Extending the Volume Group and the Logical Volume  11 15. Importing and Exporting Volume Groups..................... ...................... ...................... ...................... ..........12 16. Removing a Logical Volume.............................................................................................................................. 13 17. Moving Disks Within a System (LVM Configuration with Persistent Device Files) .. 13 18. Moving Disks Within a System (LVM Configuration with Legacy Device Files) ........ 14 19. Moving Disks Between Systems ................... ...................... ...................... ...................... ..................... ........ 14 20. Moving Data to a Different Physical Volume..................... ..................... ...................... ...................... .. 15 21. Replacing a Mirrored Non-Boot Disk.................... ...................... ...................... ..................... ...................... 15 22. Replacing an Unirrored Non-Boot Disk ...................... ..................... ...................... ...................... .............. 16 23. Replacing a Mirrored Boot Disk ..................... ...................... ...................... ...................... ..................... .......... 17 24. Creating a Spare Disk.................................................................................................................................. .......... 18 25. Reinstating a Spare Disk................................................................................................................................ ..... 18 26. Changing Physical Volume Boot Types..................... ...................... ..................... ...................... .............19 27. Enabling and Disabling a Path to a Physical Volume ................... ...................... ..................... ........ 19 28. Creating an Alternate Boot Disk.................... ...................... ...................... ..................... ...................... .......... 20 29. Mirroring the Boot Disk......................... .................... ...................... ...................... ..................... ...................... ...... 21 30. Mirroring the Boot Disk on HP 9000 Servers................... ...................... ...................... ...................... ... 22 31. Mirroring the Boot Disk on HP Integrity Servers ................... ...................... ...................... .................. 22 32. Backing Up a Mirrored Logical Volume ...................... ................................................................. ..............23 33. Backing Up and Restoring Volume Group Configuration ............................................................ 24 34. Quiescing and Resuming a Volume Group ...................................................................................... ...... 25 35. Adding a Mirror to a Logical Volume..................... ...................... ...................... ..................... .................... 25 36. Removing a Mirror from a Logical Volume ...................... ..................... ...................... ...................... ...... 26 37. Increasing the Primary Swap .................... ...................... ..................... ...................... ...................... ............... 26 38. Identifying Available Disks to be Used in a Volume Group ..................... ...................... ............. 26 39. Creating a Physical Volume Group (PVG) ....................................................................................... ...... 28 HP-UX LVM, Disk and FileSystem Tasks

Upload: rajeshsgss

Post on 04-Nov-2015

17 views

Category:

Documents


0 download

DESCRIPTION

hpux

TRANSCRIPT

  • TableofContents1.BasicTasks........................................................................................................................................................................12.RecognizingandInitializinginLVManewlyaddedDisk/LUN(Discovery/Rescan)23.RemovingaPhysicalVolume.................................................................................................................................24.CreatingaVolumeGroup.........................................................................................................................................35.AddingaDisktoaVolumeGroup......................................................................................................................46.RemovingaDiskfromaVolumeGroup.........................................................................................................57.RemovingaVolumeGroup......................................................................................................................................58.CreatingaLogicalVolumeandMountingitsFileSystem..................................................................69.ExtendingaLogicalVolumeanditsFileSystem.......................................................................................810.ReducingaLogicalVolumeanditsFileSystem.....................................................................................911.AddingaDisktoaVolumeGroupandCreatingaLogicalVolume.........................................912.AddingaDisk,CreatingaVolumeGroupandCreatingaLogicalVolume.....................1013.AddingaDisktoaVolumeGroupandExtendingaLogicalVolume..................................1114.AddingaLUN/ExternalDisk,ExtendingtheVolumeGroupandtheLogicalVolume1115.ImportingandExportingVolumeGroups.................................................................................................1216.RemovingaLogicalVolume..............................................................................................................................1317.MovingDisksWithinaSystem(LVMConfigurationwithPersistentDeviceFiles)..1318.MovingDisksWithinaSystem(LVMConfigurationwithLegacyDeviceFiles)........1419.MovingDisksBetweenSystems..................................................................................................................1420.MovingDatatoaDifferentPhysicalVolume........................................................................................1521.ReplacingaMirroredNonBootDisk...........................................................................................................1522.ReplacinganUnirroredNonBootDisk.....................................................................................................1623.ReplacingaMirroredBootDisk......................................................................................................................1724.CreatingaSpareDisk............................................................................................................................................1825.ReinstatingaSpareDisk.....................................................................................................................................1826.ChangingPhysicalVolumeBootTypes...................................................................................................1927.EnablingandDisablingaPathtoaPhysicalVolume......................................................................1928.CreatinganAlternateBootDisk.....................................................................................................................2029.MirroringtheBootDisk..........................................................................................................................................2130.MirroringtheBootDiskonHP9000Servers........................................................................................2231.MirroringtheBootDiskonHPIntegrityServers.................................................................................2232.BackingUpaMirroredLogicalVolume.....................................................................................................2333.BackingUpandRestoringVolumeGroupConfiguration............................................................2434.QuiescingandResumingaVolumeGroup............................................................................................2535.AddingaMirrortoaLogicalVolume..........................................................................................................2536.RemovingaMirrorfromaLogicalVolume.............................................................................................2637.IncreasingthePrimarySwap..........................................................................................................................2638.IdentifyingAvailableDiskstobeUsedinaVolumeGroup........................................................2639.CreatingaPhysicalVolumeGroup(PVG).............................................................................................28

    HPUXLVM,DiskandFileSystemTasks

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

    Searchforattacheddisk:ioscanfnCdisk

    GetDiskInfo:diskinfo/dev/rdsk/c0t1d0

    InitializeadiskforusewithLVM:pvcreatef/dev/rdsk/c0t1d0

    Initializethediskandcheckthediskforbadblocks:mediainit/dev/rdsk/c0t1d0

    Displayvolumegroupinfo:vgdisplayvvg01

    AsanewdiskisaddedtotheserveroranewLUNisassignedtothehost,youhavetoexecutethefollowingprocedurefortheoperatingsystemtodiscoverythedisk/LUNandtheLVMtoinitializeit.

    Checkforthenewhardware(thenewdeviceswillhaveahardwarepath,butnodevicefileassociatedwithit):ioscanfnCdisk|more

    Createthedevicefileforthehardwarepath:insf

    Ifusingvpathsthencreatethevpathassociation:/opt/IBMdpo/bin/cfgvpath

    /opt/IBMdpomaynotbethepathofthesddsoftware,sorun"whereiscfgvpath"tofindthecorrectpath.

    1.BasicTasks

    2.RecognizingandInitializinginLVManewlyaddedDisk/LUN(Discovery/Rescan)

  • Verifythenewdevices/vpaths:ioscanfnCdiskstrings/etc/vpath.cfg/opt/IBMdpo/bin/showvpath

    Createthephysicalvolume(InitializethediskforusewithLVM).Foreachdisk(notvpath)issue:pvcreatef/dev/rdsk/cxtxdx

    Forvpathsthisinformationcanbefoundinthefile/etc/vpath.cfg.

    Tosimplyremoveaphysicalvolumethat'snotusedandreferredbyLVMstructures(volumegroupsandlogicalvolumes)followthisquickprocedure.ToremoveaphysicalvolumeusedandreferredbyLVMstructuresyoufirsthavetoremovethelogicalvolumesandthevolumegroupswhichrelyonitbyfollowingtheproceduresdetailedinthesectionsbelow(RemovingaLogicalVolumeandRemovingaVolumeGroup)andthenyoucanissuethecommandsinthissection.

    Identifythehardwarepathofthedisktoremove:ioscanfnCdisk

    Removethespecialdevicefile:rmsfH

    Createthedevicestructureneededforanewvolumegroup.In themknodcommand the group number (the last parameter) is an hexadecimal and it should be different for each volumegroup.Forexample,forthevolumevg02,tipicallythesecondvolumecreated)thatnumberwouldbe0x020000.Thedefaultlimitis10volumegroupsassetbythekernelparametermaxvgs.mkdir/dev/vgdatacdvgdatamknodgroupc640x010000chownRroot:sys/dev/vgdatachmod755/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

    3.RemovingaPhysicalVolume

    4.CreatingaVolumeGroup

  • vgdisplayvvgdata

    Ifyourexpectingtousemorethan16physicaldisksusethepoption,rangefrom1to256disks.

    If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthenewstructuretotheclustertomakeitawareofit.Todothis:

    1.Umountthefilesystemwhichreliesonthelogicalvolumeanddeactivatethevolumegroup:umount/datavolvgchangean/dev/vgdata

    2.Editthecontrolscriptfileoftheclusterpackagethatwillusethelogicalvolumetoaddthereferencetoit:vi/etc/cmcluster/package_name/package_name.run3.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(alwaysonthealternatenode):mknod/dev/vgdata/groupc64

    7.Importthevolumegrouponthealternatenode:vgimportsm/tmp/vgdata.map/dev/vgdata

    8.Checkwetherthevolumegroupcanbeactivatedonthealternatenode,makeabackupofthevolumegroupconfiguration:vgchangeay/dev/vgdatavgcfgbackup/dev/vgdata

    9.Onthealternatenode,deactivatethevolumegroupandcheck:vgchangean/dev/vgdatavgdisplayvvgdata

    Note:Whenavolumegroupiscreatedthemaximumphysicalextentspervolume(max_peparameter)willbesettothemax_peofthelargestphysicalvolume(PV)or1016,whicheverisgreater,ifnomax_peisspecified.Theeffectofnotspecifyingthemax_peparameteratvolumecreationthroughtheeoptionwouldbethatanyPVaddedto thevolumegroupinthefutureregardlessoftheirsizewillbelimitedtothevolumegrougcreationvalueofmax_pe.Therefore,considerincreasingthemax_petoaccommodatePV'sthatmaylikelybelargerthanthelargestPVusedtocreatetheVolumeGroup.Theformulatousetodeterminethevalueis:physical_extent_size*max_pe=size_of_the_disk.

    Thedefaultvalue forphysical_extent_size is4Mand themaximumvalue formax_pe is65535(example for18gigdiskuseavalue4608formax_pe:4M*4608=18gig).Thereisalsoadefaultvalueofamaximumof16diskspervolumegroup.The following is an example of the creation of a volume groupmodifying these two parameters (max_pe = 4608,maximumnumberofdisk=24):vgcreatee4608p24/dev/vgdata/dev/dsk/c0t0d4

  • Runadiscoveryofthephysicaldisks/LUNs:ioscanfnCdisk

    Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolumegroupinformationsonthedisk:pvcreatef/dev/rdsk/c0t4d0vgdisplayv|grepPV

    Addthedisktothevolumegroup:vgextendvg01/dev/dsk/c0t4d0vgdisplayvvg01

    Checkwetherthediskisstillused:pvdisplay/dev/dsk/c0t4d0

    Lookatlinestartingwith"AllocatedPE"thenumberattheendofthelineshouldbe0.Ifitisnotthediskisstillinuse.

    Checkthevolumegrouplayout,thenumberofphysicalvolumes(PV)inthevolumegroupandcheckthepresenceofthediskinthevolume:vgdisplayvvg01vgdisplayvvg01|grepPVvgdisplayvvg01|grepPV|grepc0t4d0

    Removediskfromvolumegroupandchecktheresults:

    vgreducevg01/dev/dsk/c0t4d0vgdisplayvvg01|grepPVvgdisplayvvg01|grepPV|grepc0t4d0vgdisplayvvg01

    5.AddingaDisktoaVolumeGroup

    6.RemovingaDiskfromaVolumeGroup

    7.RemovingaVolumeGroup

  • Beforeremovingavolumegroup,backupthedataonthevolumesofthevolumegroup.

    Identifyallofthelogicalvolumesinthisvolumegroup:vgdisplayv/dev/vg01

    OR:vgdisplayvvg01|grep"LVName"|awk'{print$3}'

    Killtheprocessesusingthevolumesandunmountallofthelogicalvolumeswithacommandsuchasthefollowingrepeatedforeachofthevolumesinthevolumegroup:fuserku/dev/vg01/lvhomeumount/dev/vg01/lvhome

    Youcanavoidissuingmanuallytheabovetwocommandsforeachofthevolumesinthevolumegroupbyusingaforloopsuchasthefollowing(customizeitforyourneeds):for vol_name in vgdisplay v vg01 | grep "LVName" | awk '{print $3}' do fuser ku /dev/vg01/$vol_name sleep 2 umount f$vol_nameechoUmounted$vol_namedone

    Checkallofthelogicalvolumesinthevolumegroupareunmounted:bdfbdf|grepvg01

    Afteryouhavefreedandumountedallofthelogicalvolumes,removethevolumegroupandmakesomecheck:vgexport/dev/vg01vgdisplayvvg01vgdisplayv|grepvg01vgdisplayv

    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, issuethefollowingcommandsforeachlogicalvolumeinthevolumegroup:lvremove/dev/vg01/lvoln

    Then,issuethefollowingcommandforeachdiskinthevolumegroup:vgreduce/dev/vg01/dev/disk/diskn

    Youcanavoidissuingmanuallytheabovetwocommandsforeachofthevolumesanddisksinthevolumegroupbyusingaforloopsuchasthefollowing(customizeitforyourneeds):forvol_nameinvgdisplayvvg01|grep"LVName"|awk'{print$3}'dolvremove/dev/vg01/$vol_namesleep2echoRemoved$vol_namedone

    fordisk_name in `vgdisplay v | grep "PVName" | cut c3645`dovgreduce /dev/vg01 /dev/disk/$disk_namesleep2echoRemoved$disk_namedone

    Finally,removethevolumegroupandmakesomecheck:vgremovevg01vgdisplayvvg01vgdisplayv|grepvg01

  • vgdisplayv

    If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthe new structure to the cluster tomake it aware of it.To do this follow the steps about deploying LVM configuration onHPServiceGuardClusternodesattheendofthesection"CreatingaVolumeGroup".

    Runadiscoveryofthephysicaldisks/LUNs:ioscanfnCdisk

    Createa100GBlogicalvolumelvdata:

    lvcreatenlvdataL100000pwvgdatalvdisplayvlvdata

    Createthefilesystem:newfsFvxfs/dev/vgdata/rlvdata

    Createthemountpointandmountthefilesystem:mkdir/datavolmount/dev/vgdata/rlvdata/datavol

    Ifthevolumeisdedicatedtoaspecificapplication(suchasadatabaseinstanceoranapplicationserverinstance),thentypicallyyoumayneedtoassignthatmountpointpermissionsaccordingtotheapplication'sneedsandtheownershiptotheapplication'suserandgroup,forexample:chmod755/datavolchownoracle:oragroup/datavol

    Tohavethefilesystemmountedatsystem'sbootyoumusteditthe/etc/fstabtoaddtheentrycorrespondingtothenewvolumeanditsfilesystem:vi/etc/fstab/dev/vgdata/rlvdata/datavolvxfsdefaults02

    Ifthesystemonwhichyou'recreatingthelogicalvolumeisanodeofanHPServiceGuardCluster, thenyouhavetopresentthenewstructuretotheclustertomakeitawareofit.Todothis:

    1.Umountthefilesystemwhichreliesonthelogicalvolumeanddeactivatethevolumegroup:umount/datavolvgchangean/dev/vgdata

    2.Editthecontrolscriptfileoftheclusterpackagethatwillusethelogicalvolumetoaddthereferencetoit:vi/etc/cmcluster/package_name/package_name.run3.Exportthevolumegroupmap:vgexportpsm/tmp/vgdata.map/dev/vgdata

    8.CreatingaLogicalVolumeandMountingitsFileSystem

  • 4.Copymapfileandthepackagecontrolfiletoallnodesbyusingrcporscp:rcp/etc/cmcluster/package_name/package_name.rungldev:/etc/cmcluster/package_name/

    5.Checkandnotetheminornumberingroupfileforthevolumegroup:lsl/dev/vgdata/group

    6.Onthealternatenode,createthecontrolfileusingthesameminornumberoftheprimarynodenotedatstep5(alwaysonthealternatenode):mknod/dev/vgdata/groupc64

    7.Importthevolumegrouponthealternatenode:vgimportsm/tmp/vgdata.map/dev/vgdata

    8.Checkwetherthevolumegroupcanbeactivatedonthealternatenode,makeabackupofthevolumegroupconfiguration:vgchangeay/dev/vgdatavgcfgbackup/dev/vgdata

    9.Alwaysonthealternatenode,createthemountpointdirectoryandassignthepermissionsaccordinglywiththeprimarynode:mkdir/datavolchmod755/datavolchownoracle:oragroup/datavol

    10.Mountthefilesytemwhichreliesonthelogicalvolumeonthealternatenode:mount/dev/vgdata/rlvdata/datavolbdf

    11.Unmountthefilesystem,deactivatethevolumegrouponthealternatenodeandcheck:umount/datavolvgchangean/dev/vgdatavgdisplayvvgdata

    Iftheenvironmentusesmirroredindividualdisksinphysicalvolumegroups(PVGs),checkthe /etc/lvmpvg file toensurethateachphysicalvolumegroupcontainsthecorrectphysicalvolumenamesforthealternatenode.

    When you use PVGstrict mirroring, the physical volume group configuration is recorded in the /etc/lvmpvg file on theconfiguration node: this file defines the physical volume group swhich at the basis ofmirroring and indicateswhich physicalvolumesbelongtoeachphysicalvolumegroup.Oneachcluster'snode, the/etc/lvmpvgfilemustcontain thecorrectphysicalvolumenamesfor thephysicalvolumegroupssdisksastheyareknownonthatnode.Physicalvolumenamesforthesamediskscouldbedifferentondifferentnodes.After distributing volume groups to other nodes,make sure each nodes /etc/lvmpvg file correctly reflects the contents of allphysicalvolumegroupsonthatnode.

    9.ExtendingaLogicalVolumeanditsFileSystem

  • Thelogicalvolumeextensionconsistsofextendindthevolumeitselfandthenthefilesystemwhichreliesonit.

    Extendalogicalvolumeto200MB:lvextendL200/dev/vgdata/lvdatalvdisplayvlvdata

    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/lvdatafusercu/dev/vgdata/lvdataumount/dev/vgdata/lvdatabdf

    If you receivemessages telling the volume/filesystem is busyand it cannot beunmounted, then force theunmount by usingtheumountfoption:umountf/dev/vgdata/lvdata

    Defragmentthefilesystem(it'soptionalbutagoodpractice):fsadmdDeE/data

    Extendthefilesystemto200MB:

    extendfs/databdf

    Ifthe"OnlineJFS"packageisinstalled,thencalculatethespacetoaddinblocks(200MB/4MB=50LE50x1024=51200blocks)andperformtheextension:fsadmFvxfsb51200/databdf

    Ifyouwanttosetthelargefilesoptionsothefilesystemcansupportfilesgreaterthan2GB,thenyoucandoitalsoaftervolumecreationbyissuingthefollowingcommand:fsadmFvxfsolargefiles/databdf

    Beforereducingthevolumebackupthevolumedata.Toreduce(orshrink)alogicalvolumeinsizeit'snotnecessarytoumountthefilesystem,butthelogicalvolumemustbeunusedbecausenotalloftheapplicationsmighthandlethesizereductionwhilethey'reoperating.

    Checkifthereareopenfilesonthevolume:fusercu/dev/vg01/lvol5

    10.ReducingaLogicalVolumeanditsFileSystem

  • Killtheprocessesthathaveopenfilesonthevolume:fuserku/dev/vg01/lvol5

    Reducethelogicalvolumesize:lvreduceL500/dev/vg01/lvol5lvdisplayvlvol5bdf

    Runadiscoveryofthephysicaldisks/LUNs:ioscanfnCdisk

    Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolumegroupinformationsonthedisk:pvcreatef/dev/dsk/c0t5d0

    Addthedisktothevolumegroupandchecktheresult:vgextendvg00/dev/dsk/c0t5d0vgdisplayv|grepPVvgdisplayvg00

    Createthelogicalvolume:lvcreatenlvdataL100000pw/dev/vg00

    Createthefilesystem:newfsFvxfs/dev/vg00/lvdata

    Createthemountpointforthenewfilesystem:mkdirdatavol

    Ifyouwantthenewfilesystemtobemountedatsystemboot,theneditthe/etc/fstabfiletoaddtheentryforthenewlycreatedlogicalvolumeanditsfilesystem:vi/etc/fstab/dev/vg00/lvdata/datavolvxfsdefaults02

    Mountthenewfilesystem:mounta

    Note: thecommandmountamountsallof the filesystems in the /etc/fstab file,so thiscommand isuseful to testwether thenewlyaddedentryinthefile issyntacticallyright.Ifyou'resurealloftheentriesinthefilearealreadymountedandthere'sno"dangerous"entry thatmustbeskippedbymountingbut (foranyreason) itwasnotcommentedout,avoidusing themountaandissuean"explicit"mountbyspecifyingthenewfilesystemtomount(mountFfs_type/dev/vg00/lvdata/datavol).

    Makesomecheck:bdflvdisplay/dev/vg00/lvdata

    11.AddingaDisktoaVolumeGroupandCreatingaLogicalVolume

  • If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthe new structure to the cluster tomake it aware of it.To do this follow the steps about deploying LVM configuration onHPServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

    Runadiscoveryofthephysicaldisks/LUNs:ioscanfnCdisk

    Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolumegroupinformationsonthedisk:pvcreatef/dev/dsk/c0t5d0

    Addthedisktothevolumegroup:vgextendvg01/dev/dsk/c0t5d0vgdisplayv|grepPV

    Createthestructureforthevolumegroup:mkdir/dev/vg01mknod/dev/vg01/groupc640x010000chownRroot:sys/dev/vg01chmod755/dev/vg01chmod640/dev/vg01/group

    Createthelogicalvolume:lvcreatenlvdataL100000pw/dev/vg00

    Createthefilesystem:newfsFvxfs/dev/vg00/lvdata

    Createthemountpointforthenewfilesystem:mkdirdatavol

    Ifyouwantthenewfilesystemtobemountedatsystemboot,theneditthe/etc/fstabfiletoaddtheentryforthenewlycreatedlogicalvolumeanditsfilesystem:vi/etc/fstab/dev/vg00/lvdata/datavolvxfsdefaults02

    Mountthenewfilesystem:mounta

    Note: thecommandmountamountsallof the filesystems in the /etc/fstab file,so thiscommand isuseful to testwether thenewlyaddedentryinthefile issyntacticallyright.Ifyou'resurealloftheentriesinthefilearealreadymountedandthere'sno"dangerous"entry thatmustbeskippedbymountingbut (foranyreason) itwasnotcommentedout,avoidusing themountaandissuean"explicit"mountbyspecifyingthenewfilesystemtomount(mountFfs_type/dev/vg00/lvdata/datavol).

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

  • Makesomecheck:bdflvdisplay/dev/vg00/lvdata

    If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthe new structure to the cluster tomake it aware of it.To do this follow the steps about deploying LVM configuration onHPServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

    Runadiscoveryofthephysicaldisks/LUNs:ioscanfnCdisk

    Preparethediskifthediskwaspreviouslyusedinanothervolumegroupthenusethefoptiontooverwritetheexistingvolumegroupinformationsonthedisk:pvcreatef/dev/dsk/c0t5d0Addthedisktothevolumegroupandchecktheresults:vgextendvg01/dev/dsk/c0t5d0vgdisplayv|grepPVvgdisplayvg00

    Extendthelogicalvolumeandchecktheresults:lvextendL200000/dev/vg00/lvdatalvdisplay/dev/vg00/lvdatabdf

    DiscoverythenewLUN:ioscanfnCdisk>/tmp/ioscan1.txtinsfeCdiskioscanfnCdisk>/tmp/ioscan2.txtdiff/tmp/ioscan1.txt/tmp/ioscan2.txtioscanfnCdisk

    RunSAMandcheckfor"unused"hardwarepath:sam

    13.AddingaDisktoaVolumeGroupandExtendingaLogicalVolume

    14. Adding a LUN / External Disk, Extending the VolumeGroup and theLogicalVolume

  • youwillnoticesomethinglike:HardwarePathNumberofPathsUseVolumeGroupTotalMBDES1/10/0/0.115.10.19.98.1.32Unused8192IBM

    GettheLUNInfo:diskinfo/dev/rdsk/c33t1d3

    GettheVolumeGroupInfo:vgdisplayvvg01

    AdddisktotheVolumeGroup:pvcreatef/dev/rdsk/c0t4d0vgextendvg01/dev/dsk/c0t4d0vgdisplayvvg01

    ORbyUsingSAM:1)OpenSAM2)SelectDisksandFileSystems>VolumeGroups3)Arrowdowntothevolumegroupyouwanttoextend(frombdf)andhitthespacebartoselectit4)Taboncetogettothemenuatthetopandthenarrowoverto"Actions"andhitenter>5)Select"Extend"fromtheActionsmenu6)Select"SelectDisk(s)..."andhitenter7)SelecttheappropriatedisktoaddwiththespacebarandselectOK,thenSelectOKwhichwillexpandthevolum8)ExitSAM

    ChecktheFileSystemMountedontheLogicalVolumetoExtendandTakeNoteoftheSpaceInfo(kbytesusedavail%used):bdf/oradata

    ExtendtheLogicalVolume:lvextendL11776/dev/vg01/lvol3

    DefragmenttheFileSystemMountedontheLogicalVolume:fsadmdDeE/oradata

    ExtendtheFileSystemMountedontheLogicalVolume:fsadmFvxfsb11776M/oradata

    ChecktheFileSystemInfotoVerifytheCurrentSpace:bdf/oradata

    1)Makethevolumegroupunavailablebydisactivatingit:vgchangean/dev/vgdata

    2)Exportthethediskwhilecreatingalogicalvolumemapfile:vgexportvmdata_mapvgdata

    15.ImportingandExportingVolumeGroups

  • 3)Disconnectthedrivesandmovetonewsystem.

    4)Movethedata_mapfiletothenewsystem.

    5)Onthenewsystemrecreatethevolumegroupdirectory:mkdir/dev/vgdatamknod/dev/vgdata/groupc640x010000chownRroot:sys/dev/vgdatachmod755/dev/vgdatachmod640/dev/vgdata/group

    6)Importthediskstothenewsystem:vgimportvmdata_map/dev/vgdata/dev/dsk/c2t1d0/dev/dsk/c2t2d0

    7)Enablethenewvolumegroup:vgchangeay/dev/vgdata

    Beforeremovingthelogicalvolumebackupthevolumedata.

    Checkwetherprocesseshasopenfilesonthelogicalvolume:fusercu/dev/vgdata/lvdataAsthevolumehasbeenfreed,umountitandcheckifit'sbeenunmounted:fuserku/dev/vgdata/lvdatafusercu/dev/vgdata/lvdataumount/dev/vgdata/lvdatabdf

    If you receivemessages telling the volume/filesystem is busyand it cannot beunmounted, then force theunmount by usingtheumountfoption:umountf/dev/vgdata/lvdata

    Removethelogicalvolume:lvremove/dev/vgdata/lvdata

    If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthe new structure to the cluster tomake it aware of it.To do this follow the steps about deploying LVM configuration onHPServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

    16.RemovingaLogicalVolume

    17. Moving Disks Within a System (LVM Configuration with PersistentDeviceFiles)

  • Deactivatethevolumegroup:vgchangean/dev/vgnn

    Physicallymoveyourdiskstotheirdesirednewlocations.

    Activatethevolumegroup:vgchangeay/dev/vgnn

    Deactivatethevolumegroup:vgchangean/dev/vgnn

    Ifyouwanttoretainthesameminornumberforthevolumegroup,examinethevolumegroup'sgroupfile:lsl/dev/vgnn/group

    RemovethevolumegroupdevicefilesanditsentryfromtheLVMconfigurationfiles:vgexportvsm/tmp/vgnn.map/dev/vgnn

    Physicallymoveyourdiskstotheirdesirednewlocations.

    Toviewthenewlocations:vgscanv

    If youwant to retain theminor number of the volume group device file, create it (the group file in this example has amajornumberof64andaminornumberof0x01000000):mkdir/dev/vgnnmknod/dev/vgnn/groupc640x010000

    AddthevolumegroupentrybacktotheLVMconfigurationfiles:vgimportvsm/tmp/vgnn.map/dev/vgnn

    Activatethenewlyimportedvolumegroup:vgchangeay/dev/vgnn

    Backupthevolumegroupconfiguration:vgcfgbackup/dev/vgnn

    18.MovingDisksWithinaSystem(LVMConfigurationwithLegacyDeviceFiles)

  • 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_planningmknod/dev/vg_planning/groupc640x010000chownRroot:sys/dev/vg_planningchmod755/dev/vg_planningchmod640/dev/vg_planning/group

    Getdevicefileinformationaboutthedisks:ioscanfunNCdisk

    Importthevolumegroup:vgimportNvsm/tmp/vg_planning.map/dev/vg_planning

    Activatethenewlyimportedvolumegroup:vgchangeay/dev/vg_planning

    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

    19.MovingDisksBetweenSystems

    20.MovingDatatoaDifferentPhysicalVolume

    21.ReplacingaMirroredNonBootDisk

  • Takenoteofthehardwarepathstothedisk:ioscanmlun/dev/disk/disk14

    HaltLVMaccesstothediskIfthediskisnothotswappable,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 LUNinstance14fortheolddisknowhasnolunpathassociatedwithit.Ifthesystemwasrebootedtoreplacethefaileddisk,thenioscanmlundoesnotdisplaytheolddisk.

    Assigntheoldinstancenumbertothereplacementdisk(thisassignstheoldLUNinstancenumber14tothereplacementdiskandthedevicespecialfilesforthenewdiskarerenamedtobeconsistentwiththeoldLUNinstancenumber):io_redirect_dsfd/dev/disk/disk14n/dev/disk/disk28ioscanmlun/dev/disk/disk14

    RestoreLVMconfigurationinformationtothenewdisk:vgcfgrestoren/dev/vgnn/dev/rdisk/disk14

    RestoreLVMaccesstothedisk(ifthediskishotswappable):pvchangeay/dev/disk/disk14

    Ifthediskisnothotswappableandyouhadrebootthesystem,reattachthediskbyreactivatingthevolumegroupasfollows:vgchangeay/dev/vgnn

    Takenoteofthehardwarepathstothedisk:ioscanmlun/dev/disk/disk14

    HaltLVMaccesstothediskIfthediskisnothotswappable,poweroffthesystemtoreplaceit.

    Ifthediskishotswappable,disableuserandLVMaccesstoallunmirroredlogicalvolumes.

    22.ReplacinganUnirroredNonBootDisk

  • Foreachunmirroredlogicalvolumeusingthediskkillalloftheprocessesaccessingthevolume:fusercudev/vg01/lvol1fuserkudev/vg01/lvol1umount/dev/vg01/lvol1

    DisableLVMaccesstothedisk:pvchangeaN/dev/disk/disk14

    PhysicallyReplacethedisk.

    Ifthesystemwasnotrebooted,Notifythemassstoragesubsystemthatthediskhasbeenreplaced:scsimgrreplace_wwidD/dev/rdisk/disk14

    DeterminethenewLUNinstancenumberforthereplacementdisk:ioscanmlun

    Assigntheoldinstancenumbertothereplacementdisk(thisassignstheoldLUNinstancenumber14tothereplacementdiskandthedevicespecialfilesforthenewdiskarerenamedtobeconsistentwiththeoldLUNinstancenumber):io_redirect_dsfd/dev/disk/disk14n/dev/disk/disk28ioscanmlun/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

    Takenoteofthehardwarepathstothedisk:ioscanmlun/dev/disk/disk14

    HaltLVMaccesstothediskIfthediskisnothotswappable,poweroffthesystemtoreplaceit.Ifthediskishotswappable,detachit:pvchangeaN/dev/disk/disk14

    PhysicallyReplacethedisk.

    23.ReplacingaMirroredBootDisk

  • 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 LUNinstance14fortheolddisknowhasnolunpathassociatedwithit.Ifthesystemwasrebootedtoreplacethefaileddisk,thenioscanmlundoesnotdisplaytheolddisk.

    Assigntheoldinstancenumbertothereplacementdisk(thisassignstheoldLUNinstancenumber14tothereplacementdiskandthedevicespecialfilesforthenewdiskarerenamedtobeconsistentwiththeoldLUNinstancenumber):io_redirect_dsfd/dev/disk/disk14n/dev/disk/disk28ioscanmlun/dev/disk/disk14

    RestoreLVMconfigurationinformationtothenewdisk:vgcfgrestoren/dev/vgnn/dev/rdisk/disk14

    RestoreLVMaccesstothedisk(ifthediskishotswappable):pvchangeay/dev/disk/disk14

    Ifthediskisnothotswappableandyouhadrebootthesystem,reattachthediskbyreactivatingthevolumegroupasfollows:vgchangeay/dev/vgnn

    Initializebootinformationonthedisk:lvlnbootvlvlnbootR/dev/vg00lvlnbootv

    InitializethediskasanLVMdisk:pvcreate/dev/rdisk/disk3

    Ensurethevolumegrouphasbeenactivated:vgchangeay/dev/vg01

    Designateoneormorephysicalvolumesassparephysicalvolumeswithinthevolumegroup:vgextendzy/dev/vg01/dev/disk/disk3

    Alternately,youcanchangeaphysicalvolumewithnoextentscurrentlyallocatedwithinitintoasparephysicalvolume:pvchangezy/dev/disk/disk3

    24.CreatingaSpareDisk

  • Afterafaileddiskhasbeenrepairedoradecisionhasbeenmadetoreplaceit,followthesestepstoreinstateitandreturnthesparedisktoitsformerstandbystatus.

    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,andthesparediskisreturnedtoitsroleasastandbyemptydisk.

    Tochangeadisktypefrombootabletononbootable,followthesesteps:

    Usevgcfgrestoretodetermineifthevolumegroupcontainsanybootabledisks:vgcfgrestorelvnvg01

    Runvgmodifytwice,oncewiththeBnandoncewithoutit.Comparetheavailablevaluesformax_peandmax_pv:vgmodifytBnvg01/dev/rdsk/c2t1d0vgmodifytvg01

    Choosenewvaluesformax_peandmax_pv.Reviewthevaluesbyrunningvgmodifywiththenewsettingsandtheroption:vgmodifyrp6e56828Bnvg01/dev/rdsk/c2t1d0

    Deactivatethevolumegroup:vgchangeanvg01

    Committhechangesbyrunningvgmodifywithouttheroption:vgmodifyp6e56828Bnvg01/dev/rdsk/c2t1d0

    Activatethevolumegroup:

    25.ReinstatingaSpareDisk

    26.ChangingPhysicalVolumeBootTypes

  • vgchangeayvg01

    Runthevgcfgrestoreorpvdisplaycommandstoverifythatthedisktypehaschanged:vgcfgbackupvg01vgcfgrestorelvnvg01

    Todetachalinktoaphysicalvolume:pvchangean/dev/disk/disk33

    IfyouareusingLVM'salternate links formultipatheddisks,each linkusesadifferent legacydevice files. In thatsituation, todetachalllinkstoaphysicalvolume,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 thevolumegroupisactivated,eitheratboottimeorwithanexplicitvgchangecommand:vgchangeay/dev/vg02

    WithnonLVMdisks,asinglerootdiskcontainsalltheattributesneededforboot,systemfiles,primaryswap,anddump.UsingLVM,asinglerootdiskisreplacedbyapoolofdisks,arootvolumegroup,whichcontainsallofthesameelementsbutallowinga root logical volume, a boot logical volume, a swap logical volume, and one ormore dump logical volumes. Each of theselogicalvolumesmustbecontiguous,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.Ifyoucurrentlyhaveacombinedroot and boot logical volume and you want to reconfigure to separate them after creating the boot logical volume, usethelvlnbootcommandwiththeboptiontodefinethebootlogicalvolumetothesystem,takingeffectthenexttimethesystemisbooted.

    Ifyoucreateyourrootvolumegroupwithmultipledisks,usethe lvextendcommandtoplacetheboot, root,andprimaryswaplogicalvolumesonthebootdisk.

    Youcanusepvmovetomovethedata fromanexisting logicalvolumetoanotherdisk ifnecessary tomakeroomfor therootlogicalvolume.

    27.EnablingandDisablingaPathtoaPhysicalVolume

    28.CreatinganAlternateBootDisk

  • Createabootablephysicalvolume:OnanHPIntegrityserver,partitionthediskusingtheidiskcommandandapartitiondescriptionfile,thenruninsf.

    RunpvcreatewiththeBoption.OnanHPIntegrityserver,usethedevicefiledenotingtheHPUXpartition:pvcreateB/dev/rdisk/disk6_p2

    OnanHP9000server,usethedevicefilefortheentiredisk:pvcreateB/dev/rdisk/disk6

    Createadirectoryforthevolumegroup:mkdir/dev/vgrootmknod/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

    ORmkfsFvxfs/dev/vgroot/rrootlv

    OnHPIntegrityservers,thebootfilesystemcanbeVxFS:

  • mkfsFvxfs/dev/vgroot/rbootlv

    Afteryoucreatemirrorcopiesoftheroot,boot,andprimaryswaplogicalvolumes,ifanyoftheunderlyingphysicalvolumesfail,thesystemcanusethemirrorcopyontheotherdiskandcontinue.Whenthefaileddiskcomesbackonline,itisautomaticallyrecovered,providedthesystemhasnotbeenrebooted.

    If thesystemrebootsbeforethedisk isbackonline,reactivatethevolumegrouptoupdatetheLVMdatastructuresthat trackthediskswithinthevolumegroup.Youcanusevgchangeayeventhoughthevolumegroupisalreadyactive.

    Toreactivatevolumegroupvg00:vgchangeay/dev/vg00

    Asaresult,LVMscansandactivatesallavailabledisksinthevolumegroupvg00,includingthediskthatcameonlineafterthesystemrebooted.

    Theprocedureforcreatingamirrorof thebootdisk isdifferentforHP9000andHPIntegrityservers.HPIntegrityserversusepartitionedbootdisks.

    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 volumeson themirrorbootdiskmustbeextended in thesameorder that theyareconfiguredon theoriginalbootdisk.Determinethelistoflogicalvolumesintherootvolumegroupandtheirorder:pvdisplayv/dev/disk/disk0|grep'current.*0000$'

    29.MirroringtheBootDisk

    30.MirroringtheBootDiskonHP9000Servers

  • Mirroreachlogicalvolumeinvg00(therootvolumegroup)ontothespecifiedphysicalvolume:lvextendm1/dev/vg00/lvol1/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol2/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol3/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol4/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol5/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol6/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol7/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol8/dev/disk/disk2_p2lvsyncT/dev/vg00/lvol*

    Updatetherootvolumegroupinformation:lvlnbootR/dev/vg00lvlnbootv

    Specifythemirrordiskasthealternatebootpathinnonvolatilememory:setboota0/1/1/0.0x1.0x0

    Addalineto/stand/bootconfforthenewbootdisk:vi/stand/bootconfl/dev/disk/disk4

    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 volumeson themirrorbootdiskmustbeextended in thesameorder that theyareconfiguredon theoriginalboot

    31.MirroringtheBootDiskonHPIntegrityServers

  • disk.Determinethelistoflogicalvolumesintherootvolumegroupandtheirorder:pvdisplayv/dev/disk/disk0_p2|grep'current.*0000$'

    Mirroreachlogicalvolumeinvg00(therootvolumegroup)ontothespecifiedphysicalvolume:lvextendm1/dev/vg00/lvol1/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol2/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol3/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol4/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol5/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol6/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol7/dev/disk/disk2_p2lvextendm1/dev/vg00/lvol8/dev/disk/disk2_p2lvsyncT/dev/vg00/lvol*

    Iflvextendfailswiththemessage"m:illegaloptionHPMirrorDisk/UXisnotinstalled".

    Updatetherootvolumegroupinformation:lvlnbootR/dev/vg00lvlnbootv

    Specifythemirrordiskasthealternatebootpathinnonvolatilememory:setboota0/1/1/0.0x1.0x0

    Addalineto/stand/bootconfforthenewbootdisk:vi/stand/bootconfl/dev/disk/disk2_p2

    Youcansplit amirrored logical volume into two logical volumes toperformabackuponanofflinecopywhile theother copystaysonline.Whenyoucompletethebackupoftheofflinecopy,youcanmergethetwologicalvolumesbackintoone.Tobringthe twocopiesback insynchronization,LVMupdates thephysicalextents in theofflinecopybasedonchangesmade to thecopythatremainedinuse.

    YoucanuseHPSMHtosplitandmergelogicalvolumes,orusethelvsplitandlvmergecommands.

    Tobackupamirroredlogicalvolumecontainingafilesystem,usinglvsplitandlvmerge,followthesesteps:

    Splitthelogicalvolume/dev/vg00/lvol1intotwoseparatelogicalvolumes:lvsplit/dev/vg00/lvol1

    Performafilesystemconsistencycheckonthelogicalvolumetobebackedup:fsck/dev/vg00/lvol1b

    Mountthefilesystem:mkdir/backup_dirmount/dev/vg00/lvol1b/backup_dir

    Performthebackup.

    32.BackingUpaMirroredLogicalVolume

  • Unmountthefilesystem:umount/backup_dir

    Mergethesplitlogicalvolumebackwiththeoriginallogicalvolume:lvmerge/dev/vg00/lvol1b/dev/vg00/lvol1

    If youbackup your volumegroup configuration, you can restore a corruptedor lost LVMconfiguration in the event of a diskfailureorcorruptionofyourLVMconfigurationinformation.

    Itisimportantthatvolumegroupconfigurationinformationbesavedwheneveryoumakeanychangetotheconfigurationsuchasaddingor removingdisks toavolumegroup,changing thedisks inarootvolumegroup,creatingor removing logicalvolumes,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/disk5vgcfgrestoren/dev/vgsales/dev/rdisk/disk5pvchangeay/dev/disk/disk5

    If thephysicalvolumeisnotmirroredor themirrorcopiesarenotcurrentandavailable,youmustdeactivatethevolumegroupwithvgchange,performthevgcfgrestore,andactivatethevolumegroup:vgchangean/dev/vgsalesvgcfgrestoren/dev/vgsales/dev/rdisk/disk5vgchangeay/dev/vgsales

    Ifyouplantouseadiskmanagementutilitytocreateabackupimageorsnapshotofallthedisksinavolumegroup,youmustmakesure thatLVM isnotwriting toanyof thediskswhen thesnapshot isbeing takenotherwise, somediskscancontainpartiallywrittenorinconsistentLVMmetadata.

    Tokeepthevolumegroupdiskimageinaconsistentstate,youmusteitherdeactivatethevolumegrouporquiesceit.

    33.BackingUpandRestoringVolumeGroupConfiguration

    34.QuiescingandResumingaVolumeGroup

  • Deactivatingthevolumegrouprequiresyoutocloseallthelogicalvolumesinthevolumegroup,whichcanbedisruptive.Quiescingthevolumegroupenablesyoutokeepthevolumegroupactivatedandthelogicalvolumesopenduringthesnapshotoperation,minimizingtheimpacttoyoursystem.

    Youcanquiescebothreadandwriteoperationstothevolumegroup,orjustwriteoperations.Whileavolumegroupisquiesced,thevgdisplaycommandreportsthevolumegroupaccessmodeasquiesced.The indicated I/O operations queue until the volume group is resumed, and commands that modify the volume groupconfigurationfailimmediately.

    Bydefault,thevolumegroupremainsquiesceduntilitisexplicitlyresumed.Youcanspecifyamaximumquiescetimeinsecondsusingthetoptionofthevgchangecommand:ifthequiescetimeexpires,thevolumegroupisresumedautomatically.ThevgchangeQoptionindicatesthequiescingmode,whichcanberw.

    Toquiesceavolumegroupforamaximumoftenminutes(600seconds):vgchangeQwt600vg08

    Toresumeaquiescedvolumegroup:vgchangeRvg08

    Addamirrorcopytoalogicalvolume:lvextendm1/dev/vg00/lvol1

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

    Toremovemirrorcopiesreducingitto0copies:lvreducem0/dev/vg00/lvol1

    Toremovemirrorcopiesreducingitto1copy:lvreducem1/dev/vg00/lvol1

    Toremovethemirrorcopyfromaspecificdiskreducingitto0copies:lvreducem0/dev/vg00/lvol1/dev/disk/disk4

    35.AddingaMirrortoaLogicalVolume

    36.RemovingaMirrorfromaLogicalVolume

  • Becauseof thecontiguousallocationpolicy,youcannotextendtheswap logicalvolume:soto increasetheprimaryswapyoucreateabiggerlogicalvolumeandmodifytheBootDataReservedArea(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

    RecoveranymissinglinkstoallofthelogicalvolumesintheBDRAandupdatetheBDRAofeachbootablephysicalvolumeinthevolumegroup.Updatetherootvolumegroupinformation:lvlnbootR/dev/vg00

    Rebootthesystem:init6

    Listthedisks/LUNs:ioscanfunCdisk

    Someofthedevicesyouseeintheoutputoftheprevioscommandwillbeallocated,somewillnot.

    Listallofthephysicalvolumedandtheirdevicesforalloftheexistingvolumegroups:vgdisplayvvgdisplayv|grepPV

    Thisisalistofthedevicesthatareinuse(astheyarepartofavolumegroup).

    Now,comparethetwooutputs:anydevicethat'sintheioscanoutput,butNOTinthevgdisplayoutputareavailableforuse.

    Youcanautomatethisprocessbyusingsed,awkandgrep.

    1.Createafile(herenamedwte_hitachi_disk)listingallofthedisksthatcanbeused(inthisexampleHITACHI):

    37.IncreasingthePrimarySwap

    38.IdentifyingAvailableDiskstobeUsedinaVolumeGroup

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

    1. CreateafilecontainingtheioscanfnCdiskoutput2. catwilloutputthefilecontainingthediskioscan3. seddeletesthefirst2headerlinesofthefile4. grepprintsoutanylinesthatDONOTincludeTOSHIBAorc2t0d05. xargsgroupstheoutputintogroupsof106. NextgrepfindsallofthelineswithHITACHIinthem7. 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 thesystem:awk'{print$9}'wte_hitachi_disk|sortu>wte_hitachi_sorted_u

    1. awkprintsjustthe9thfieldofthefile2. sortusortsthefileandsurpressesanyduplicates3. Thisissavedtothesortedfilewte_hitachi_sorted_u.

    Printalistofallthedisksthatarecurrentlybeingused(alistofPVs):vgdisplayv|grep"PVName">wte_pvdisk_used

    1. vgdisplayvprintsaverboselistingofallvolumegroups2. greponlyprintslinesthatcontainPVName3. ThelistofPVsissavedtothefilewte_pvdisk_used.

    Refinethelistofdisksthatarebeingused:awk'{print$3}'wte_pvdisk_used|sortu>wte_pvdisk_sorted_u

    1. awkprintsonthe3rdfield(thediskdevice)2. sortsortsthelist,surpressinganyduplicateentries3. Theresultsaresavedtothefilewte_pvdisk_sorted_u.

    ComparethetwofilesthelistofalltheHitachidisksonthesystemwiththelistofalldisksbeingused:diffwte_hitachi_sorted_uwte_pvdisk_sorted_u

    1. diffcomparesthetwofilesandprintsoutanydifferences.Thedifferencewillbeoneormoredisksthat thesystemsees,butthatarenotbeingusedbyLVM.

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

    39.CreatingaPhysicalVolumeGroup(PVG)

  • HencePVG's.Youcreateoneforthedisksononecontroller,anotheroneforthedisksontheothercontroller,thenyoumakelogicalvolumesPVGstrict(lvchangesg...).

    PVGsincreasenotonlyI/Ohighavailabilitybutalsoperformance.

    ByusingPVGsphysicalvolumescanbegroupedbycontrollers: then logicalvolumescanbecreatedondifferentPVGs.ThiswayPVGsallowtoknowwhereeachdiskisandwhatchannelstomirrordown,sowithcarefulplanninganddiligentuseoftheLVMcommandsyoucanensureI/OseparationwithoutusingLVM.

    Description:raphics/06fig01.jpg

    Youcanusetwomirroringtypes.

    Cleanmirror:WhencreatingthevolumegroupyouwouldsetitupbyputtingAandBinPVG1,andCandDinPVG2:youdothisbyusing"g"option involumegroupcreation todefine thePVGname.Whencreating logicalvolumesyoumay tomirror (forexample)1copy,youcanput themirroredcopy inaseparatePVGso thatyourmirroredcopiesarealways inPVG2, forexample.Thiswould help in disaster recovery situation. The lvcreatecommandhas "sg" option to setup a PVGstrict mirror. To extend alogicalvolumeyouissueastraightforwardlvextendsinceitwasalreadydefinedasPVGstrict.

    Dirtymirror:Thevolumegroupissetupinanormalmanner.Whencreatinglogicalvolumes,ifyousetuptomirror1copyanddonotspecifytoLVMwheretoputitsmirroredcopythenyoumayendupinasiuationwherebythemirroredcopycanresideanywhereinA,B,C,D,evenonthediskwheretheprimarycopyresides.Soyoucanactuallyinstructlvextendtoputthemirrorcopyonaspecificdisk,butthenyouwouldhavetokeeptrackofthePEs,etc...IfPVGissetupthisisdoneautomatically.

    Tocreateaphysicalvolumegroup(PVG)createafilenamed/etc/lvmpvgwiththefollowingsyntax:VGvg_namePVGpvg_namepv_path...PVGpvg_namepv_path...VGvg_namePVGpvg_namepv_path[...]

    Forexample,tousetwoPVGsinvg01withc1t6d0andc2t6d0inonePVG(PVG0),c3t6d0andc4t6d0intheotherPVG(PVG1)thecontentsofthefile/etc/lvmpvgshouldbe:VG/dev/vg01PVGPVG0/dev/dsk/c1t6d0/dev/dsk/c2t6d0PVGPVG1/dev/dsk/c3t6d0/dev/dsk/c4t6d0

  • Thencreatethephysicalvolumegroups:vgcreategpvg1/dev/vgname/dev/dsk/c5t8d0/dev/dsk/c5t9d0vgextendgpvg2/dev/vgname/dev/dsk/c7t1d0/dev/dsk/c7t2d0vgdisplayvvgname

    If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthe new structure to the cluster tomake it aware of it.To do this follow the steps about deploying LVM configuration onHPServiceGuardClusternodesattheendofthesection"CreatingaVolumeGroup".

    Aftercreatingthe/etc/lvmpvgfileasdescribeaboveintheprevioussection,eachcopyofthemirroryoucreatecouldbeforceondifferentPVG.

    Tocreatealogicalvolumeinthephysicalvolumegroup:lvcreatem1nvolume_nameLsize_in_mbsg/dev/pvg_namelvdisplayvlvhome

    To create a RAID 0 + 1 you need at least two disks in each PVG, then you use the "s g & D Y" options ofthelvcreatecommandduringthelogicalvolumecreation.

    Ifthelogicalvolumeisalreadycreatedbutnotmirroredyet,issuethefollowingcommand:lvchangesg/dev/vg01/lvhomelvextendm1/dev/vg01/lvhomelvdisplayvlvhome

    If thesystemonwhichyou'recreatingthevolumegroupisanodeofanHPServiceGuardCluster, thenyouhavetopresentthe new structure to the cluster tomake it aware of it.To do this follow the steps about deploying LVM configuration onHPServiceGuardClusternodesattheendofthesection"CreatingaLogicalVolumeandMountingtheFileSystem".

    40.Creating(Mirroring)LogicalVolumesonSpecificPhysicalVolumes