HPUX LVM Cheat Sheet

Scan for Disks

Run the command below to scan for disks.

ioscan -fnC disk

Make your physical volume

This is the first step in the creation of a physical volume.

pvcreate -f /dev/rdsk/c0t1d0

Create the device structure using mknod

Mknon creates a FIFO, character special file, or block special file with the
specified name. You will need to do this when you are creating a volume group.

              cd /dev
              mkdir vgdata
              cd vgdata
              mknod group c 64 0x010000

What is above is only an example, your minor number will vary by machine.

     mknod [options]... NAME Type [Major Minor]

Create volume group

Using vgcreate,you need to create you volume group and list all the disks
that are to make up this volume group. In the example below we are creating a
volume group called vgdata.

                vgcreate vgdata  /dev/dsk/c0t1d0

Below is an example from one of the DCA boxes:

                 vgcreate /dev/vgapcj06 /dev/dsk/c7t2d2 /dev/dsk/c7t2d3 /dev/dsk/c7t2d4

Once created use vgdisplay to display information pertaining to your new
volume.

                 vgdisplay -v vg01
updca003(root)#vgdisplay vgapcj06
--- Volume groups ---
VG Name                     /dev/vgapcj06
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      0
Open LV                     0
Max PV                      16
Cur PV                      3
Act PV                      3
Max PE per PV               8690
VGDA                        6
PE Size (Mbytes)            4
Total PE                    26067
Alloc PE                    0
Free PE                     26067
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0

Create a Logical Volume

See the example below that was created with the -l option which used logical
extents to determine the size for the logical volume

updca003(root)#lvcreate -n ndata6 -l 26067 /dev/vgapcj06
Logical volume "/dev/vgapcj06/ndata6" has been successfully created with
character device "/dev/vgapcj06/rndata6".
Logical volume "/dev/vgapcj06/ndata6" has been successfully extended.
Volume Group configuration for /dev/vgapcj06 has been saved in /etc/lvmconf/vgapcj06.conf
updca003(root)#lvdisplay /dev/vgapcj06/ndata6
--- Logical volumes ---
LV Name                     /dev/vgapcj06/ndata6
VG Name                     /dev/vgapcj06
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            104268
Current LE                  26067
Allocated PE                26067
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default

Make a filesystem

   updca003(root)#newfs /dev/vgapcj06/rndata6
   newfs: /etc/default/fs is used for determining the file system type
   version 4 layout
   106770432 sectors, 13346304 blocks of size 8192, log size 256 blocks
   unlimited inodes, largefiles not supported
   13346304 data blocks, 13345512 free data blocks
   408 allocation units of 32768 blocks, 32768 data blocks
   last allocation unit has 9728 data blocks

Other LVM Commands for HPUX

Export disk group

  • vgexport /dev/disgroup

this deactivates the diskgroup

  • vgchange -a n <diskgroup>

this activates a diskgroup

  • vgchange -a y <diskgroup>

Grow a logical volume

  • lvextend

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s