Add disk to lvm

List of commands to add new disk to lvm and add storage to /.

Format drive fdisk /dev/sdb:

[root@centos7 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x4507ff75.
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-16777215, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-16777215, default 16777215): 
Using default value 16777215
Partition 1 of type Linux and of size 8 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Create pv on sdb1

pvcreate /dev/sdb1

Add to vg

vgextend name_of_vg /dev/sdb1

lvresize -l +100%free path_of_lv

find out file system on partition 

grep root /etc/mtab

case:

    xfs: 

xfs_growfs /dev/mapper/...

    ext4:

 resize2fs /dev/mapper/...

done

Share: