Extending Volumes and Filesystems

 Identify the volume you want to extend.

[root@db1 log]# df -h

Filesystem            Size  Used Avail Use% Mounted on
                      7.6G  3.8G  3.5G  52% /
                       69G   69G    0  100% /opt  <---- /opt is FULL!

Let's identify the Logical Volume that's full, and the Volume Group it's on. 

               ^    ^   69G   69G    0  100% /opt  <---- /opt is FULL!
                                        |             |
                                        |            +- - Logical Volume
       Volume Group  +

The name you see 'datavg-opt'was auto-created based on the names of the VG (volume group) and LV (logical volume) you choose when you created them. In our case we knew what we wanted to do with them, so we choose names that had some meaning, i.e. a VG for data, and a LV that we planned to mount at /opt, but could have been named anything and mounted anywhere, such as  /dev/mapper/VolGroup00-LogVol00 and /var/logs

[root@db1 log]# lvs

  LV          VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  opt         datavg   -wi-ao  69.99G   
  sysroot     systemvg -wi-ao   7.81G

[root@db1 log]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/datavg/opt   <-----  Note the name is /dev/datavg/opt
  VG Name                datavg            

Add and prepare a disk

You could use already available space or move data around and re-partitioned, but lets assume you added a new drive

If you added more space to an exiting drive, such as extending a virtual disk, create a partition in that space and use it. BUT if you have a GPT partitioning system (Fedora 16) you must move the Partition Table back to the end. 

# Scan for a new hard drive
# assuming you have 'host0', ls /sys/class/scsi_host if not sure
[root@db1 log]# echo "- - -" > /sys/class/scsi_host/host0/scan

# See what the new HDD shows up as
[root@db1 log]# dmesg
  sd 0:0:3:0: Attached scsi disk sdd         <-------- disk is sdd
  sd 0:0:3:0: Attached scsi generic sg3 type 0

# Prepare the disk and add to the group and volume, then re-size
pvcreate /dev/sdd
vgextend datavg /dev/sdd
lvextend -l +100%FREE /dev/datavg/opt
resize2fs /dev/datavg/opt

You can also partition the disk with fdisk and issue the commands against /dev/sdd1 if you do not want to use the entire disk.