jump to navigation

Configuring File System on HP-UX using LVM Wednesday, December 12, 2007

Posted by piyut in HP-UX.
trackback

Before you perform the installation, verify that you have root permissions on the Agent Host.

1. Create Volume Group

Note: the following example is using the disk c1t6d0, the volume group vg01, the logical volume lvtest, and mount point /test

1.1 Identify the disks to be used for LVM

# ioscan -nfC disk

1.2 Create a LVM data structure on each identified disk

# pvcreate /dev/rdsk/c1t6d0

Note: if the disk was previously used in another VG, use the following command instead:

# pvcreate -f /dev/rdsk/ c1t6d0

1.3 Collect all the physical volumes to form a new volume group

1.3.1 Go to dev directory (/dev)

# cd /dev

1.3.2 Create VG name

# mkdir vg01

1.3.3 Make directory and special file in VG

# mknod /dev/vg01/group c 64 0×010000

Note: the group number (last parameter - 0×010000 ) is in hexadecimal and should be different for each volume group

1.3.4 Create the volume group

# vgcreate -s [pe_size] -e [max_pe] /dev/vg01 /dev/dsk/ c1t6d0

Note: when a volume group is created without define pe_size and max_pe parameter, the maximum physical extents per volume (max_pe) will be set to the max_pe of the largest physical volume (PV). The effect of not setting the max_pe parameter would be that any PV added to the volume group in the future regardless of there size will be limited to the volume groug creation value of max_pe. Therefore, consider increasing the max_pe to accommodate PV’s that may likely be larger than the largest PV used to create the Volume Group. The formula to use to determine the value is:

physical_extent_size * max_pe = size_of_the_disk.

The default value for physical_extent_size is 4 MB and the maximum value for max_pe is 65535

2. Create the logical volumes

# lvcreate -L 1024 -n lvtest /dev/vg01

Note: lv_size is 1024 MB

3. Create a file system

# newfs -F vxfs -o largefiles /dev/vg01/rlvtest

4. Mounting a file system

# mkdir /test

# mount /dev/vg01/lvtest /test

5. Adding a Disk to Volume Group

Note: the following example is using the disk c1t6d1 and the volume group vg01

5.1 Prepare the disk

# pvcreate /dev/rdsk/c1t6d1

Note: if the disk was previously used in another VG, use the following command instead:

# pvcreate -f /dev/rdsk/c1t6d1

5.2 Add the disk to volume group

# vgextend /dev/vg01 /dev/dsk/c1t6d1

6. Increase the Logical Volume without online JFS

Note: the following example is using volume group vg01 and logical volume lvtest

6.1 Increase the size

# lvextend -L 2046 /dev/vg01/lvtest

Note:the new_size is 2046 MB

6.2 umount the file system

#umount /test

6.3 re-create the file system

# extendfs -F vxfs /dev/vg01/rlvtest

6.4 mount the logical volume

# mount /dev/vg01/lvtest /test

7. Reduce the Size of a Logical Volume Without Online JFS

Note: the following example is using volume group vg01 and logical volume lvtest

7.1 backup all data

7.2 umount the file system

# umount /test

7.3 reduce the size

# lvreduce -L 1536 /dev/vg01/lvtest

Note: the new total size will be 1536 MB

7.4 re-create the file system

# newfs -F vxfs /dev/vg01/rlvtest

7.5 mount the logical volume

# mount /dev/vg01/lvtest /test

7.6 restore backup data

8. Remove a Disk from a Volume Group

Note: the following example is using disk c1t6d1 and volume group vg01

8.1 make sure that the disk is not in use

# pvdisplay /dev/dsk/c1t6d1

Note: look at line starting with Allocated PE, the number at the end of the line should be 0. if it is not, the disk still in use

8.2 remove the disk

# vgreduce /dev/vg01 /dev/dsk/c1t6d1

9. Remove Volume Group

Note: the following example is using volume group vg01 and the logical volume lvtest

9.1 backup all data

9.2 find the name of all logical volume in this volume group

# vgdisplay -v /dev/vg01

9.3 unmont all logical volumes belongs to vg01

# umount /dev/vg01/lvtest

9.4 Deactivate volume group

# vgchange -a n /dev/vg01

9.5 remove the volume group

# vgexport /dev/vg01

Comments»

No comments yet — be the first.