Extend LVM logical volumes in RHEL4

If you needs to extend a LVM logical volume under RHEL4, know that the process is very simple. You will need.

  1. A new physical, logical or storage device.
  2. Format this device and create a LVM partition.
  3. Create a LVM physical volume.
  4. Add the physical volume to the existing volume manager.
  5. Extend the logical volume.
  6. Extend the file system in real time.

Use the following command to scan new storage devices.

# cd /sys/class/scsi_host ; ls | while read -r line ; do echo "- - -" > $line/scan ; done

Format the LUN, physical or logical disk using type 8e, that is the LVM format.

# printf "n\np\n1\n\n\nx\nb\n1\n128\np\nw\n" | fdisk /dev/sda1

Create the LVM physical volume.

# pvcreate /dev/sda1

Extend the volume manager, in my case the volume manager is oracle_vg.

# vgextend oracle_vg /dev/sda1

Extend the LVM logical volume, in my case the logical volume is oracle_lvol.

# lvextend -L100%FREE /dev/oracle_vg/oracle_lv

Extend the filesystem in real time, in my case was an ext2 file system.

# ext2online /dev/oracle_vg/oracle_lv

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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