*********************************************************
john's notes
*********************************************************
john's SYSADM page. --
note: these are HP-UX commands

to identify disks --> ioscan -fn -C disk

  • pvcreate
  • vgcreate
  • vgextend
  • lvextend
LOGICAL VOLUME PHYSICAL DEVICE FILE SYSTEM
volume group one or more disks vgdisplay
physical volume group physical extents on a drive pvdisplay
logical volume group multiple physical volume groups, one or more disks lvdisplay

HP Disk Setup
700 Series 800 Series
install h/w install h/w
mknod insf -e
________ mediainit ________ pvcreate, vgcreate, lvcreate
newfs newfs
mount mount
/etc/checklist /etc/checklist

HP LVM COMMANDS
COMMAND LVM FUNCTION
vgcreate Create a Volume Group. (Create a subset of the overall LVM.)
pvcreate Create a Physical Volume, assign to Volume Group. (Specify a disk for inclusion in the overall LVM.)
vgextend Add a new physical disk to a volume group.
lvcreate Create a Logical Volume. (storage area for related files that is part of a Volume Group. A Volume Group consists of many logical volumes.)
lvextend Increase the size of a Logical Volume.
lvreduce Decrease the size of a Logical Volume.
lvremove Removes a Logical Volume. (frees the storage area set aside for a logical volume.)
vgreduce Reduce a Volume Group. (Reduces the number of disks in a Volume Group.)
vgremove Remove a Volume Group. (Removes the designation of a group of disks as a Volume Group.)
vgdisplay Volume Group Display. (Displays information about one or more Volume Groups.)
pvdisplay Physical Volume Display. (Displays information about one or more Volume Groups.)
lvdisplay Logical Volume Display. (Displays information about one or more Logical Volumes.)
A logical volume lives in a volume group that is made up of one or more physical volumes. All Volume Groups are part of the Logical Volume Manager.

HP LOGICAL VOLUME COMMANDS
COMMAND Logical Volume FUNCTION
lvcreate Creates new Logical Volume. A logical volume is created within a Volume Group.
lvchange
lvdisplay
lvextend
lvlnboot
lvsplit
lvmerge
lvmmigrate
lvreduce
lvremove
lvrmboot
lvsync

HP PHYSICAL VOLUME COMMANDS
COMMAND Physical Volume FUNCTION
pvchange
pvcreate
pvdisplay
pvmove

HP VOLUME GROUP COMMANDS
COMMAND Volume Group FUNCTION
vgcfgbackup
vgcfgrestore
vgchange
vgcreate
vgdisplay
vgexport
vgextend
vgimport
vgreduce
vgremove
vgscan
vgsync

to remove and recreate a volume group:

create vg or extend

lvisplay -v /dev/vgsys01/sys34
lvremove /dev/vgsys01/sys34
lvcreate -n sys34 /dev/vgsys01
lvextend -l 1023 /dev/vgsys34/sys34 /dev/dsk/c179d0s2

initialize disk

pvcreate -f /dev/rdsk/c194d0s2
lvcreate -n sys35 /dev/vgsys01
lvextend -l 1023 /dev/vgsys35 /dev/dsk/c1194d0s2

manually reduce a vg

vgreduce /dev/vgsys01 /dev/dsk/c195d0s2

to make bootable mirror on vg00:

  1. pvcreate -B /dev/rdsk/c4t5d0
  2. vgextend /dev/vg00 /dev/dsk/c4t5d0
  3. mkboot /dev/rdsk/c4t5d0
  4. mkboot -a "hpux (10/0.5.0;0)/stand/vmunix" /dev/rdsk/c4t5d0
  5. lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c4t5d0
     The newly allocated mirrors are now being synchronized. This operation will 
    take some time. Please wait ....
    Logical volume "/dev/vg00/lvol1" has been successfully extended.
    Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
    
  6. lvlnboot -v
    
    host.root-#->lvlnboot -v
    Boot Definitions for Volume Group /dev/vg00:
    Physical Volumes belonging in Root Volume Group:
            /dev/dsk/c4t6d0 (10/0.6.0) -- Boot Disk
            /dev/dsk/c4t5d0 (10/0.5.0) -- Boot Disk
    Boot: lvol1     on:     /dev/dsk/c4t6d0
    Root: lvol3     on:     /dev/dsk/c4t6d0
    Swap: lvol2     on:     /dev/dsk/c4t6d0
    Dump: lvol2     on:     /dev/dsk/c4t6d0, 0
    
    Current path "/dev/dsk/c1t9d0" is an alternate link, skip.
    Current path "/dev/dsk/c1t9d1" is an alternate link, skip.
    Current path "/dev/dsk/c0t5d2" is an alternate link, skip.
    Current path "/dev/dsk/c0t5d3" is an alternate link, skip.
    host.root-#->
    
  7. vgdisplay -v vg00
    
    host.root-#-> vgdisplay -v vg00
    --- Volume groups ---
    VG Name                     /dev/vg00
    VG Write Access             read/write     
    VG Status                   available                 
    Max LV                      255    
    Cur LV                      8      
    Open LV                     8      
    Max PV                      16     
    Cur PV                      2      
    Act PV                      2      
    Max PE per PV               1023         
    VGDA                        4   
    PE Size (Mbytes)            4               
    Total PE                    2046    
    Alloc PE                    846     
    Free PE                     1200    
    Total PVG                   0        
    
       --- Logical volumes ---
       LV Name                     /dev/vg00/lvol1
       LV Status                   available/syncd           
       LV Size (Mbytes)            48              
       Current LE                  12        
       Allocated PE                24          
       Used PV                     2       
    
       LV Name                     /dev/vg00/lvol2
       LV Status                   available/syncd           
       LV Size (Mbytes)            1664            
       Current LE                  416       
       Allocated PE                416         
       Used PV                     1       
    
       LV Name                     /dev/vg00/lvol3
       LV Status                   available/syncd           
       LV Size (Mbytes)            84              
       Current LE                  21        
       Allocated PE                21          
       Used PV                     1       
    
       LV Name                     /dev/vg00/lvol4
       LV Status                   available/syncd           
       LV Size (Mbytes)            28              
       Current LE                  7         
       Allocated PE                7           
       Used PV                     1       
    
       LV Name                     /dev/vg00/lvol5
       LV Status                   available/syncd           
       LV Size (Mbytes)            600             
       Current LE                  150       
       Allocated PE                150         
       Used PV                     1       
    
       LV Name                     /dev/vg00/lvol6
       LV Status                   available/syncd           
       LV Size (Mbytes)            304             
       Current LE                  76        
       Allocated PE                76          
       Used PV                     1       
    
       LV Name                     /dev/vg00/lvol7
       LV Status                   available/syncd           
       LV Size (Mbytes)            448             
       Current LE                  112       
       Allocated PE                112         
       Used PV                     1       
    
       LV Name                     /dev/vg00/lvol8
       LV Status                   available/syncd           
       LV Size (Mbytes)            160             
       Current LE                  40        
       Allocated PE                40          
       Used PV                     1       
    
       --- Physical volumes ---
       PV Name                     /dev/dsk/c4t6d0
       PV Status                   available    
       Total PE                    1023    
       Free PE                     189     
    
       PV Name                     /dev/dsk/c4t5d0
       PV Status                   available    
       Total PE                    1023    
       Free PE                     1011    
    
    host.root-#->
    

LOGICAL VOLUMES ADDED TO A VOLUME GROUP


/sbin/lvcreate -i 2 -I 64 -L 2000 -n db13 /dev/vg05
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db14 /dev/vg05
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db15 /dev/vg05
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db16 /dev/vg05
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db17 /dev/vg06
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db18 /dev/vg06
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db19 /dev/vg06
/sbin/lvcreate -i 2 -I 64 -L 2000 -n db20 /dev/vg06

adding logical volumes to a volume group

host.root-#->/sbin/lvcreate -i 2 -I 64 -L 2000 -n db13 /dev/vg05 Logical volume "/dev/vg05/db13" has been successfully created with character device "/dev/vg05/rdb13". Logical volume "/dev/vg05/db13" has been successfully extended. Volume Group configuration for /dev/vg05 has been saved in /etc/lvmconf/vg05.conf host.root-#->/sbin/lvcreate -i 2 -I 64 -L 2000 -n db14 /dev/vg05 Logical volume "/dev/vg05/db14" has been successfully created with character device "/dev/vg05/rdb14". Logical volume "/dev/vg05/db14" has been successfully extended. Volume Group configuration for /dev/vg05 has been saved in /etc/lvmconf/vg05.conf host.root-#->/sbin/lvcreate -i 2 -I 64 -L 2000 -n db15 /dev/vg05 Logical volume "/dev/vg05/db15" has been successfully created with character device "/dev/vg05/rdb15". Logical volume "/dev/vg05/db15" has been successfully extended. Volume Group configuration for /dev/vg05 has been saved in /etc/lvmconf/vg05.conf host.root-#->/sbin/lvcreate -i 2 -I 64 -L 2000 -n db16 /dev/vg05 Logical volume "/dev/vg05/db16" has been successfully created with character device "/dev/vg05/rdb16". Logical volume "/dev/vg05/db16" has been successfully extended. Volume Group configuration for /dev/vg05 has been saved in /etc/lvmconf/vg05.conf

using VGDISPLAY to verify added volume groups

.root-#->vgdisplay -v vg05 | more --- Volume groups --- VG Name /dev/vg05 VG Write Access read/write VG Status available Max LV 255 Cur LV 4 Open LV 4 Max PV 16 Cur PV 2 Act PV 2 Max PE per PV 1024 VGDA 4 PE Size (Mbytes) 8 Total PE 1022 Alloc PE 1000 Free PE 22 Total PVG 0 --- Logical volumes --- LV Name /dev/vg05/db13 LV Status available/syncd LV Size (Mbytes) 2000 Current LE 250 Allocated PE 250 Used PV 2 LV Name /dev/vg05/db14 LV Status available/syncd LV Size (Mbytes) 2000 Current LE 250 Allocated PE 250 Used PV 2 LV Name /dev/vg05/db15 LV Status available/syncd LV Size (Mbytes) 2000 Current LE 250 Allocated PE 250 Used PV 2 LV Name /dev/vg05/db16 LV Status available/syncd LV Size (Mbytes) 2000 Current LE 250 Allocated PE 250 Used PV 2 --- Physical volumes --- PV Name /dev/dsk/c1t0d0 PV Status available Total PE 511 Free PE 11 PV Name /dev/dsk/c1t1d0 PV Status available Total PE 511 Free PE 11 Standard input: END

lvdisplay the new logical volume



hostt.root-#->lvdisplay -v /dev/vg05/db13 | more
--- Logical volumes ---
LV Name                /dev/vg05/db13
VG Name                /dev/vg05
LV Permission          read/write   
LV Status              available/syncd      
Mirror copies          0            
Consistency Recovery   MWC                 
Schedule               striped      
LV Size (Mbytes)       2000            
Current LE             250       
Allocated PE           250         
Stripes                2       
Stripe Size (Kbytes)   64                  
Bad block              on           
Allocation             strict               
IO Timeout (Seconds)   default             

   --- Distribution of logical volume ---
   PV Name            LE on PV  PE on PV  
   /dev/dsk/c1t0d0    125       125       
   /dev/dsk/c1t1d0    125       125       

   --- Logical extents ---
   LE   PV1                PE1  Status 1 
   0000 /dev/dsk/c1t0d0    0000 current  
   0001 /dev/dsk/c1t1d0    0000 current  
   0002 /dev/dsk/c1t0d0    0001 current  
   0003 /dev/dsk/c1t1d0    0001 current  
   0004 /dev/dsk/c1t0d0    0002 current  
   0005 /dev/dsk/c1t1d0    0002 current  
   0006 /dev/dsk/c1t0d0    0003 current  
   0007 /dev/dsk/c1t1d0    0003 current  
   0008 /dev/dsk/c1t0d0    0004 current  
   0009 /dev/dsk/c1t1d0    0004 current  
   0010 /dev/dsk/c1t0d0    0005 current  
   0011 /dev/dsk/c1t1d0    0005 current  
   0012 /dev/dsk/c1t0d0    0006 current  
   0013 /dev/dsk/c1t1d0    0006 current  
   0014 /dev/dsk/c1t0d0    0007 current  
   0015 /dev/dsk/c1t1d0    0007 current  
   0016 /dev/dsk/c1t0d0    0008 current  
   0017 /dev/dsk/c1t1d0    0008 current  
   0018 /dev/dsk/c1t0d0    0009 current  
   0019 /dev/dsk/c1t1d0    0009 current  
   0020 /dev/dsk/c1t0d0    0010 current  
   0021 /dev/dsk/c1t1d0    0010 current  
   0022 /dev/dsk/c1t0d0    0011 current  
   0023 /dev/dsk/c1t1d0    0011 current  
......
   0245 /dev/dsk/c1t1d0    0122 current  
   0246 /dev/dsk/c1t0d0    0123 current  
   0247 /dev/dsk/c1t1d0    0123 current  
   0248 /dev/dsk/c1t0d0    0124 current  
   0249 /dev/dsk/c1t1d0    0124 current  

Standard input: END

newfs using SAM


commands only:

# Tue Sep 30 23:43:13 1997: Began creating a new file system on logical volume # /dev/vg06/db20. /usr/bin/mkdir -p /db20 /usr/sbin/newfs -F vxfs /dev/vg06/rdb20 /usr/sbin/mount -u -o rw,suid,delaylog -F vxfs /dev/vg06/db20 /db20 /usr/bin/cp /etc/fstab /etc/fstab.old # Tue Sep 30 23:43:16 1997: Completed creating a new file system on logical # volume /dev/vg06/db20. /usr/sbin/mount|/usr/bin/sed -n 's,^[^ ]* on \([^ :]*\):\([^ ]*\).*,\1 \2,p' /usr/bin/grep '^/' /etc/exports ps -ef | awk '/[ \/]automount[ \t].*$/ { for (i=1; i<=NF; ++i){ if \ (substr($i,1,2) == "-f") if (length($i)>2) print substr($i,3); else print \ $(i+1); }}' - /etc/auto_master \ # Tue Sep 30 23:43:17 1997: Began initializing the File Systems sub-area. /usr/sbin/mount -u tmpfile=/var/tmp/bdf.err; rc=0; /usr/bin/bdf -b 2> $tmpfile | awk ' { if (flag \ == 1) { print saved_df, $1, $2, $3, $4, $5; flag = 0 } else if ($2 == "") { \ saved_df = $1; flag = 1 } else print $1, $2, $3, $4, $5, $6 }' ; if [[ -s \ $tmpfile ]]; then rc=1; cat $tmpfile 1>&2 ; fi; rm $tmpfile ; exit $rc /usr/sbin/swapinfo -fdmrt /sbin/lvlnboot -v vg00 2> /dev/null | awk '$1=="Swap:" { if ( substr( $2, 1, 1 \ ) == "/" ) { print substr( $2, 2 ) } else { print $2 } }' if [ -f /etc/auto_master ]; then /usr/sam/lbin/autoopt -l -f/etc/auto_master ; \ fi; -hosts|/net||||soft||| \ # Tue Sep 30 23:43:18 1997: Completed initializing the File Systems sub-area.

all the verbose and gory details

----- Tue Sep 30 23:43:13 1997: Began creating a new file system on logical volume /dev/vg06/db20. * Creating the directory /db20. * Performing task "Make new directory.": Creating directory /db20. * Executing the following command: /usr/bin/mkdir -p /db20 * Command completed with exit status 0. * Performing task "Create a new file system.": New file system being created on /dev/vg06/rdb20. * Executing the following command: /usr/sbin/newfs -F vxfs /dev/vg06/rdb20 * Command completed with exit status 0. * Performing task "Mount a file system.": Mounting file system at /db20. * Executing the following command: /usr/sbin/mount -u -o rw,suid,delaylog -F vxfs /dev/vg06/db20 /db20 * Command completed with exit status 0. * Performing task "Make safe copy of /etc/fstab.". * Executing the following command: /usr/bin/cp /etc/fstab /etc/fstab.old * Command completed with exit status 0. * Adding the following entry to "/etc/fstab": /dev/vg06/db20 /db20 vxfs rw,suid,delaylog 0 2 ----- Tue Sep 30 23:43:16 1997: Completed creating a new file system on logical volume /dev/vg06/db20. * Performing task "Checks if any remote file systems are mounted.". * Executing the following command: /usr/sbin/mount|/usr/bin/sed -n 's,^[^ ]* on \([^ :]*\):\([^ \ ]*\).*,\1 \2,p' * Command completed with exit status 0. * Task: "Checks if any remote file systems are mounted." succeeded. * Performing task "Check if /etc/exports exists and contains entries.". * Executing the following command: /usr/bin/grep '^/' /etc/exports * Command completed with exit status 1. ERROR - it does not * Performing task "Get the name of the current NFS Automounter master map from the current automount process.". * Executing the following command: ps -ef | awk '/[ \/]automount[ \t].*$/ { for (i=1; i<=NF; ++i){ if \ (substr($i,1,2) == "-f") if (length($i)>2) print substr($i,3); \ else print $(i+1); }}' - * Command completed with exit status 0. * The command wrote the following to stdout: /etc/auto_master \ ----- Tue Sep 30 23:43:17 1997: Began initializing the File Systems sub-area. * Performing task "Updating /etc/mnttab.". * Executing the following command: /usr/sbin/mount -u * Command completed with exit status 0. * Performing task "Get all currently mounted file systems.". * Executing the following command: tmpfile=/var/tmp/bdf.err; rc=0; /usr/bin/bdf -b 2> $tmpfile | awk ' \ { if (flag == 1) { print saved_df, $1, $2, $3, $4, $5; flag = 0 } \ else if ($2 == "") { saved_df = $1; flag = 1 } else print $1, $2, \ $3, $4, $5, $6 }' ; if [[ -s $tmpfile ]]; then rc=1; cat $tmpfile \ 1>&2 ; fi; rm $tmpfile ; exit $rc * Command completed with exit status 0. * Performing task "Getting all current swap information.". * Executing the following command: /usr/sbin/swapinfo -fdmrt * Command completed with exit status 0. * Performing task "Check if a volume group has a logical volume which is the primary swap device.". * Executing the following command: /sbin/lvlnboot -v vg00 2> /dev/null | awk '$1=="Swap:" { if ( \ substr( $2, 1, 1 ) == "/" ) { print substr( $2, 2 ) } else { print \ $2 } }' * Command completed with exit status 0. * Performing task "Get the list of NFS Automounter file systems.". * Executing the following command: if [ -f /etc/auto_master ]; then /usr/sam/lbin/autoopt -l \ -f/etc/auto_master ; fi; * Command completed with exit status 0. * The command wrote the following to stdout: -hosts|/net||||soft||| \ ----- Tue Sep 30 23:43:18 1997: Completed initializing the File Systems sub-area.


john's home page. -- john's SYSADM page. -- HTML tags page. -- cool awk tricks -- find commands -- nfs example --
System Administration Humor (?):
SysAdmin field guide -- SysAdmin song -- an SA should never say... -- EMAIL TO: john@wagoneers.com
Copyright © 1997 John Meister All rights reserved.