April 16, 2016

adding free space to LVM

I replaced 146GB drives with 300GB drives in a HP server and extended the Raid 5 partition using HP smart array manager. I now have a 900GB HP Raid array logical volume and want to use the free space in CentOS 7 with LVM.

I want to allocate the free space to my home filesystem. What is the best way to accomplish this? I thought about trying to use fdisk to change the ending sector for partition 2 to have it end at 900 instead of 450. I know I could create a new partition with the free space and add it to the LVM group. Then add that to the filesystem. I'm not sure what is the best approach so thought I would ask the group. Thanks!

 

This is the output of parted and fdisk.

[root@jpvmserver ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print devices                                                   
/dev/sda (900GB)
/dev/mapper/centos_jpvmserver-home (367GB)
/dev/mapper/centos_jpvmserver-swap (34.4GB)
/dev/mapper/centos_jpvmserver-root (26.8GB)
(parted) print free
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 900GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  2149MB  2147MB  primary  ext3         boot
 2      2149MB  430GB   428GB   primary               lvm
        430GB   900GB   470GB            Free Space

(parted) q                                                               
[root@jpvmserver ~]# fdisk -l

Disk /dev/sda: 899.9 GB, 899898718208 bytes, 1757614684 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00050878

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     4196351     2097152   83  Linux
/dev/sda2         4196352   840550399   418177024   8e  Linux LVM

Disk /dev/mapper/centos_jpvmserver-root: 26.8 GB, 26843545600 bytes, 52428800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos_jpvmserver-swap: 34.4 GB, 34359738368 bytes, 67108864 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos_jpvmserver-home: 367.0 GB, 367001600000 bytes, 716800000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Click Here!