Sei sulla pagina 1di 5

Logical Volume Manager (LVM) using HP-UX Glossary

Term JournaledFileSystem(JFS) LogicalExtents LogicalInterchangeFormat(LIF) LogicalVolumes Mirroring PhysicalExtent(PE) PhysicalPartitions PhysicalVolume Striping Volume VolumeGroup Definition Unixfilesystemthatusesajournaledlogtorecordchangestothefilesystem.Intheeventofafailurethe logcanbeusedtorecover. Logicalextentsareusedtocreatethelogicalvolume-theyarethesamesizeasphysicalextents HPStorageformatusedforinterchangeoffilesbetweenHPsystems. Allocatesthespaceinsideavolumegroup,thelogicalvolumegetsthefilesystem Mappingalogicalextenttomorethanonephysicalextent.Logicalvolumesaremirrored,notdisks. Unitusedforallocatingdiskspacetologicalvolumes,defaultsizeis4MB.Itisasetofcontiguousdisk blocks. Thephysicalvolumeisorganizedintoblockscalledphysicalpartitions(sameasphysicalextent??) PhysicaldiskthatisbeingmanagedbyLVM Alogicalvolumethatisconfiguredtowriteacrossmorethanonediskinastripe. Adeviceusedforstorage-eitheranentirediskorapartition. Containoneormorephysicalvolumes,aphysicalvolumecanonlybeinonevolumegroup(poolof partitions)

Commands
Command lvcreate lvdisplay-v/dev/<VG>/<LV> pvchange pvcreate/dev/rdsk/cxtxdx pvcreate-f/dev/rdsk/cxtxdx pvdisplay/dev/dsk/cxtxdx pvdisplay-v/dev/dsk/cxtxdx vgchange vgcreate vgdisplay[-v][VG_NAME} vgexport vgimport Commandusedtocreatelogicalvolumes Commandusedtodisplayinformationaboutlogicalvolumes Changestheattributesofexistingphysicalvolumes. CreatesaphysicalvolumebycreatingtheLVMdatastructuresonthephysicaldiskcalledphysicalextents. The-foptionwillforcethecreationofthePV-potentiallydestroyingoldPVinformation. Commandusedtodisplayinformationaboutphysicalvolumes Commandusedtochangeinformationaboutthevolumegroup,suchastoactivateaninactivevg Commandusedtocreatethevolumegroups Commandusedtodisplayinformationaboutvolumegroups,-vistheverboseoptionwhichwilllistlvsand pvs. Function

Files
File /dev/dsk/cxtxdx /dev/rdsk/cxtxdx /dev/<volumegroup>/group /etc/lvmrc /etc/lvmtab /etc/vpath.cfg Blockdevicefordisk Characterdevicefordisk Characterdevicefile(createdwiththemknodcommand)thatallowsthelvmkernelandthelvmcommands tocommunicate Scriptthatstartseachvolumegroupbaseduponthecontentsof/etc/lvmtab Thisfilehasthedevicefileassociatedwitheachdiskinavolumegroup.Accessitwiththestrings command. IfIBMSDDisbeingusedthisfilecontainsthemappingofvpathtothecorrespondingdisk-target-lun. Accessitwiththestringscommand. Description

Procedures Filesystem Procedures:


Create a new filesystem: (Anewfilesystemwillrequireanewlogicalvolume) 1. CreatetheLogicalVolume(ProcedureBelow) 2. CreatetheFileSystem Usingnewfs: 1. newfs-F<filesystem_type><path_to_lvol_devicefile>

15

2012-11-1311:05

3.

4.

5.

6.

2. newfs-Fvxfs/dev/vg02/lvol1 Usingmkfs: 1. mkfs-F<FILESYSTEMTYPE>-obsize=<OPTIONS>,<OPTIONS><PATHTOLV> 1. -Fisfilesystemtype,suchasvxfsfortheVeritasFileSystemorJFS 2. -oareoptions,suchasbsize(BlockSize)andlargefiles. 3. PathtoLVisoftheform/dev/VGNAME/LVNAME 2. Forexample:"mkfs -F vxfs -o bsize=8192,largefiles /dev/bgbill/lvbill" CreatetheMountPoint 1. mkdir-p<fullpathtomountpoint> 2. -pwillmakeanysubdirectoriesinthepaththatdonotalreadyexist Settheproperownershipandpermissionsonthemountpoint 1. chownowner:group/<mountpoint> 2. chmodXXX/<mountpoint> MounttheFileSystem 1. Edit/etc/fstabusingviandaddtheproperentry 1. <LVPATH><MOUNTPOINTPATH><FILESYSTEM><OPTIONS><BACKUPFREQUENCY><PASSNUMBER> 2. Forexample:"/dev/vgbill/lvbill /maindir/subdir/share vxfs rw,suid,largefiles,delaylog,datainlog 0 2" 2. "mount /<mountpoint>"tomountthefilesystem Test 1. Doa"bdf <mount point>".Thiscommandwillshowifthefilesystemismounted,andit'ssize. 2. Doan"ls -ld <mount point>"toverifythattheproperpermissionsarethere. 3. Havetheusertestthefilesystem,andreportbackwithanyproblems

Extending a VxFS Filesystem (Online JFS) 1. Verifythatthereisenoughspaceinthevolumegroup Checkthevolumegroupforenoughspace vgdisplay<VGName> Checkthelogicalvolumetodetermineifmirroringorstripingisineffect lvdisplay/dev/vg_name/lv_name Ifthereisnotenoughspacethenthevolumegroupmustbeextended-seeprocedurebelow. 2. Firstlvextendthelogicalvolume-2Optionsforlvextend: 1. lvextend-L<NewSizeinMB>/dev/VG_NAME/LV_NAME 2. lvextend-l<NEWSizein#ofLEs>/dev/VG_NAME/LV_NAME 3. fsadm-Fvxfs-b<newsizeoffilesysteminK><MOUNTPOINT> NOTE:extendfswillNOTworkwithOnlineJFS,youmustusefsadm NOTE:newsizeofthefilesystem=<#ofLEs>*<LESizeinMB>*1024 NOTE:Iflvextend-LwasusedsimplymultipysizeinMBby1024 NOTE:IfthisFAILSwitherrno28,thenthefilesystemis100%fullandmustbereducedtolessthan100%. NOTE:IfthisFAILSwith"writefailureatblockXXXXXXXX:Nosuchdeviceoraddress"thenthenewsizemaybetoobig,useasmallernumber Extending a VxFS Filesystem (No Online JFS) 1. Verifythatthereisenoughspaceinthevolumegroup vgdisplay<VGName> Ifthereisnotenoughspacethenthevolumegroupmustbeextended-seeprocedurebelow. 2. Firstlvextendthelogicalvolume-2Optionsforlvextend: 1. lvextend-L<NewSizeinMB>/dev/VG_NAME/LV_NAME 2. lvextend-l<NEWSizein#ofLEs>/dev/VG_NAME/LV_NAME 3. Unmountthefilesystem 4. extendfs-Fvxfs/dev/<VG_Name>/r<LV_Name> Note:extendfsusestherawlogicalvolumename(ierlvol1)

How to determine if you have Online JFS swlist-lfileset|grep-iadvanced How to determine the filesystem type grep<mountpoint>/etc/fstab Resultsshouldshowthefilesystemtype(vxfsorhfs)inthereturnstring

Logical Volume Procedures:


Creating a Logical Volume: 1. Determineifanexistingvolumegrouphasenoughsparecapacityforanewlogicalvolume. 1. Ismirroringorstripingrequired(ifnotknown,thenseeifotherlogicalvolumesinthatvolumegroupuseit)? 2. vgdisplay<Thiswilllistexistingvolumegroups 1. SparecapacityisindicatedbythenumberoffreePEs 2. Multiplythe"FreePE"by"PESize(MBytes)"togetsparecapacityinMBofthevolumegroup Note:Ifmirroringorstripingisrequiredthentheremustbeenoughspaceavailableonmultipledisks 3. Isthereavolumegroupwithenoughsparecapacity? 1. Ifyes,thecontinueto"CreatetheLogicalVolume" 2. Ifno,thentheVolumeGroupmustbeextendedoranewVolumeGroupmustbecreated-seeproceduresbelow. 2. Createthelogicalvolume: lvcreate-1<sizeinLEs>-n<LVName>-rN<VGDirectorypath>OR

25

2012-11-1311:05

1. -lissizeinLogicalExtents(sameasPEsize) 2. -nisthenameoftheLogicalVolume 3. -rNdisablebadblockallocation lvcreate-L<sizeinMBs>-n<LVName>-rN<VGDirectorypath> 1. lvcreate-L100/dev/vg01 Logicalvolumewillbe100MBinsize Nameofthelogicalvolumedefaultnamewillbelvolx 2. lvcreate-L100-noracle/dev/vg01 Thiscreatesalogicalvolumecalledoracleof100MB 3. Verifythelvwascreatedproperly"vgdisplay -v <volume group>" Removing a Logical Volume Unmountthefilesystem umount/<PathtoMountPoint> Removethevolumegroup lvremove/dev/<VG_NAME>/<LV_NAME> Cleanup Deletethemountpoint Removethemountfrom/etc/fstab

Troubleshooting(justanidea,notsureifthisreallyworks??) ONCTRA01#lvchange-an/dev/vg_wte_test/lv_wte_test Logicalvolume"/dev/vg_wte_test/lv_wte_test"hasbeensuccessfullychanged. VolumeGroupconfigurationfor/dev/vg_wte_testhasbeensavedin/etc/lvmconf/vg_wte_test.conf Unmirroring a Logical Volume lvreduce-m0/dev/<VG_NAME>/<LV_NAME>

Volume Group Procedures:


Create a Volume Group 1. Determinethelistofdiskdevicesthatwillmakeupthevolumegroup(procedurebelow) 2. CreatePVdisksforeachofthedisks(procedurebelow) 3. Createthevolumegroupdirectory 1. mkdir/dev/vg01 4. Createthegroupfile 1. Determinetheminornumbertouse 1. ls-l/dev/*/group|sort+5 2. Choosethenextunusednumber 2. mknod/dev/vol_group_directory/groupcMajor_numberMinor_number 1. mknod/dev/vg01/groupc640x010000 2. Thegroupfileisusedtoallowcommunicationsbetweenthelvmcommandsandthelvmkernel 5. Createthevolumegroup 1. vgcreate-l255-p64-s16/dev/<vgid>/dev/dsk/<diskid><--createthevolumegroupwithinitialdiskdevices 1. -lsetsthemaximumnumberoflogicalvolumesforthevolumegroup 2. -psetsthemaximumnumberofphysicalvolumesforthevolumegroup 3. -ssetsthephysicalextentsize 4. /dev/<vgid>isthevolumegroupdirectory 5. /dev/dsk/diskidarethephysicalvolumestobeaddedtothevolumegroup 6. vgcreate/dev/vg01/dev/dsk/c1t0d0/dev/dsk/c1t1d0 2. vgextend/dev/vgxx/dev/dsk/diskid<--addsadditionaldiskdevicestothevolumegroup Extending a Volume Group AvolumegroupisextendedbyaddingadditionalPVstoitwithvgextend vgextend/dev/vgxx/dev/dsk/diskid Note:IftherearenoavailablePVs,thendiskspace(LUNS)mustbeaddedtothesystemandPVsmustbecreated-seeproceduresbelow. Activating a Volume Group 1. 2. 3. 4. vgchange-ay/dev/<vgname> mount-a==>Thismayindicatethatafilesystemcheckneedstoberun(fsck) fsck-m/dev/<vgname>/<lvname>==>thisisasanitycheck,itisveryquick,butmayindicatethatacompletefsckneedstoberun fsck/dev/<vgname>/<lvname>==>thisisthefullfilesystemcheck

Deactivating a Volume Group 1. umountallofthelogicalvolumesinthevolumegroup Determineallofthemountedlogicalvolumesby"bdf | grep vg_name" 2. vgchange-an/dev/<vgname>

Adding mirroring to the root vg - vg00

35

2012-11-1311:05

1. pvcreate-B/dev/rdisk/c2t2d0 CreatethePVontheseconddisksothatLVMcanmanageit -Bmakesitabootablevolume 2. mkboot/dev/rdsk/c2t2d0 Installsthebootfilesontheseconddisk 3. mkboot-a"hpux-lq(;0)/stand/vmunix"/dev/rdsk/c2t2d0 Createsanautobootfileonthedisk,withinformationonhowtoboot 4. vgextend/dev/vg00/dev/dsk/c2t2d0 extendsthevolumegrouptoincludethisseconddisk. 5. vgdisplay-vvg00 Toverifythattheseconddiskisnowpartofthevolumegroup 6. lvlnboot-v Toverifythatthesystemthinksthisdiskcanboot 7. lvextend-m1/dev/vg00/lvol1/dev/dsk/c2t2d0 Thisextendsthelogicalvolumetothemirroreddisk,effectivelycreatingthemirroredcopy. Thiscommandneedstoberunforeachlogicalvolumeinthevolumegroup

Removing a Volume Group Toremoveavolumegroupusingvgreduceandvgremove: RemoveallLogicalVolumes(seeprocedureabove) removealldisksexceptonusingvgreduce <VG_NAME> </dev/dsk/DISK> Thiswillneedtobedoneforeachdiskinthevolumegroup,exceptforthelastdisk removethefinaldiskinthevolumegroupwithvgremove <VG_NAME> Toremoveavolumegroupusingvgexport: Deactivethevolumegroup vgexport-m<mapfile>-v-f<devicefile><VG_NAME>

PV Procedures:
How to recognize a newly added LUN: 1. Checkforthenewhardware ioscan-fnCdisk|more<--thenewdeviceswillhaveahardwarepath,butnodevicefileassociatedwithit. 2. Createthedevicefileforthehardwarepath insf 3. Ifusingvpathsthencreatethevpathassociation /opt/IBMdpo/bin/cfgvpath /opt/IBMdpomaynotbethepathofthesddsoftware,"whereiscfgvpath"mayneedtoberuntofinditifitisnotinpath. 4. Verifythenewdevices/vpathsarethere: ioscan-fnCdisk strings/etc/vpath.cfg /opt/IBMdpo/bin/showvpath 5. CreatethePV Foreachdiskdevice(notvpath)issuea"pvcreate/dev/rdsk/cxtxdx" Noteforvpathsthisinformationcanbefoundin/etc/vpath.cfg How to create Physical Volumes: 3MethodsofUsingpvcreate: pvcreate/dev/rdsk/cxtxdx Notethiscommandusesthe"r"versionofthedevice pvcreate-f/dev/rdsk/cxtxdx Note:the-foptionwilloverwriteexistingpvdataonthediskdevice Notethiscommandusesthe"r"versionofthedevice pvcreate-B/dev/rdsk/cxtxdx MakesthePVbootcapable Notethiscommandusesthe"r"versionofthedevice

How to determine available disks to be used in a Volume Group: 1. "ioscan -funC disk"willlistallofthediskdevices 1. Someofthesedeviceswillbeallocated,somewillnot 2. "vgdisplay -v"willlistallofthePVsandtheirdevicesforalloftheexistingvolumegroups 1. Thisisalistofthedevicesthatareinuse 3. Anydevicesthatareontheioscan,butareNOTonthevgdisplayareavailableforuse 1. Possiblestrategytoautomatethisprocessusingsed,awkandgrep 1. createafilethathasallofthedisksthatcanbeused(inthisexampleHITACHI) 1. catwte_disk_ioscan|sed1,2d|grep-v-eTOSHIBA-ec2t0d0|xargs-n10|grepHITACHI|grep-visubsystem>wte_hitachi_disk 1. catwilloutputthefilethatcontainsthediskioscan(ioscan-fnCdisk) 2. sedisusedtodeletethefirst2headerlinesofthefile. 3. NextgrepisusedtoprintanylinesthatDONOTincludeTOSHIBAorc2t0d0 4. xargsisusedtogrouptheoutputintogroupsof10 5. NextgrepfindsallofthelineswithHITACHIinthem

45

2012-11-1311:05

6. AllofthelinesthathaveHITACHIinthemaresavedtoafile 2. RefinetheioscanofHITACHIdiskstoincludejustthediskdevices,sorted-thisisalistofallHITACHIdisksonthesystem 1. awk'{print$9}'wte_hitachi_disk|sort-u>wte_hitachi_sorted_u 1. awkprintsjustthe9thfieldofthefile 2. sort-usortsthefileandsurpressesanyduplicates 3. Thisissavedtoasortedfile 3. Printalistofallthedisksthatarecurrentlybeingused(alistofPVs) 1. vgdisplay-v|grep"PVName">wte_pvdisk_used 1. vgdisplay-vprintsaverboselistingofallvolumegroups 2. greponlyprintslinesthatcontainPVName 3. ThelistofPVsissavedtoafile 4. Refinethelistofdisksthatarebeingused 1. awk'{print$3}'wte_pvdisk_used|sort-u>wte_pvdisk_sorted_u 1. awkprintsonthe3rdfield(thediskdevice) 2. sortwillsortthelist,surpressinganyduplicateentries 3. theresultsaresavedtoafile 5. Comparethe2files-thelistofallHitachidisksonthesystemwiththelistofalldisksbeingused 1. diffwte_hitachi_sorted_uwte_pvdisk_sorted_u 1. diffcomparesthe2filesandprintsoutanydifferences.Thedifferencewillbeadiskthatthesystemsees,butthatisnotbeing usedbyLVM How to remove PVs Identifythehardwarepathofthedisktoremove ioscan-fnCdisk Removethespecialdevicefile rmsf-H<HWPathfromioscan>

How to perform an non-destructive test of a disk: ddif=/dev/rdsk/cxxxxxxof=/dev/nullbs=1024k

55

2012-11-1311:05

Potrebbero piacerti anche