Wednesday, 24 October 2012

How to create LVM on HP-UX

HP-UX


  • Create a new LVM
  • Extend an existing LVM

Create a new LVM


         STEPS:

      • Create the Physical Volume
      • Create the Volume Group
      • Create a Logical Volume
      • Create the File System


1.Check the list of devices, look for a new disk. The new devices will have a hardware path, but no device file associated with it  (no /dev/dsk/c*t*d* /dev/rdsk/c*t*d*)

# ioscan - fnkc disk

2.Create the device special file for the new hardware path

# insf

3.Check the list of devices to very the special files have been created

# ioscan -fnkC disk

4.Create the PV

# pvcreate /dev/rdsk/c*t*d*    (use -B to have a PV boot capable)

5.Create the Volume Group directory

# mkdir /dev/vgXX

6.Create the group file

Determine the minor number to use:

# ls -l /dev/*/group | sort +5

Choose the next unused number (0x0X0000)

# mknod /dev/vgXX/group c 64 0x0X0000

7.Create the volume group

# vgcreate -s 16 /dev/vgXX /dev/dsk/cxtxdx /dev/dsk/cxtydx

# vgextend /dev/vgxx /dev/dsk/cxtzdx

8.Create the Logical Volume

Check the space available on the VG

# vgdisplay -v vgXX ( Multiply the "Free PE" by "PE Size (MBytes)" to get spare capacity in MB of the volume group )

create the LV

# lvcreate -L 100 -n LVname /dev/vgXX

check the created LV

# vgdisplay -v LVname 

9.Create the FileSystem

# mkfs -F vxfs -o largefiles /dev/vgXX/LVname

10.Create the Mount Point

# mkdir -p <full path to mountpoint>

11.Set the proper ownership and permissions on the mount point

# chown owner:group /<mount point>
# chmod XXX /<mount point>

12.Mount the File System

Edit /etc/fstab using vi and add the proper entry

/dev/vgXX/LVname  /mountpoint vxfs rw,suid,largefiles 0 2

# mount /mountpoint

Check everything is ok

# bdf

DONE



Extend an existing LVM

          STEPS:
      • Add a disk to VG
      • Extend the LV
      • Extend the FS

1.Any devices that are on the ioscan, but are NOT on the vgdisplay are available for use

To get the list of devices:

# ioscan -fnC disk | sed 1,2d | xargs -n 10 | grep HITACHI

To get the list of disks used in the VG's

# vgdisplay -v | grep  "PV Name"

Compare the two and find unused disks 

2.Add unused disks to VG

# pvcreate /dev/rdsk/unused_cxtxdx

# vgextend /dev/vgxx /dev/dsk/unused_cxtxdx


3.Extend the Logical Volume

# lvextend -L XXXMb /dev/vgXX/LVname

4.Extend File System

First kill all process locking the FS then unmount the FS finally extend the FS and mount again the FS

# fuser -ku /dev/vgXX/LVname
# umount /dev/vgXX/LVname 
# extendfs /mountpoint
# mount /mountpoint


DONE




No comments:

Post a Comment