Extending an LVM

Adding more space an LVM using a partition.  You can use the entire disk instead of a partition and skip the fdisk part and start with the pvcreate /dev/sdc.

  •  echo “- – -” >/sys/class/scsi_host/host1/scan (I had a host0 and host1 but nothing changed after I did host0 and after host1 I saw /dev/sdc doesn’t contain a valid partition table)
  • fdisk -l
  • fdisk /dev/sdc <–or whatever fdisk -l finds
  • n   add a new partition
  • p   primary partition (1-4)
  • 1   for partition number
  • 1   for first cylinder (default)
  • 5221   last cylinder (default)
  • t   change a partition’s system id
  • 8e  Linux LVM
  • w   write table to disk and exit
  • pvcreate /dev/sdc1
  • vgextend RDM_DB_TEST /dev/sdc1 (RDM_DB_TEST is the name of the VG I’m increasing)
  • vgdisplay RDM_DB_TEST (note the Free PE/Size )
  • lvextend -l+10238 /dev/RDM_DB_TEST/RDM_DB_TEST_LV1 (or can use -L12G for total 12G or -L+12 to add 12 more or -l +100%FREE for all space available)
  • resize2fs /dev/RDM_DB_TEST/RDM_DB_TEST_LV1 (ext2online for RHEL 4)

If you want to see the device map for disk drives:
ls -ld /sys/block/sd*/device


Leave a Reply

Your email address will not be published. Required fields are marked *