
LVM divides storage devices into fixed sized chunks called extents. Logical volume centos/root successfully resized. Size of logical volume centos/root changed from <6.67 GiB (1707 extents) to 14.70 GiB (3764 extents). Now I use lvresize to add the extra ~]# lvresize -l +100%free /dev/centos/root I am going to add the entire disk to the root volume that is presented as the block device /dev/centos/root. I have two logical volumes in the centos volume group. If you wish to add space to a current logical volume, as is common in virtual environments, use lvdisplay and lvresize to view your logical volumes and resize them, respectively.įirst, I will use lvdisplay to view my logical volumes.

Volume group "centos" successfully extended Concatenation Now use vgextend to add the disk to the centos volume group. On my example system, I have a single volume group named centos. The VG column displays the names of the volume groups. If you want to add it to an existing volume group, first determine the name of the volume group. Volume group "new_vg" successfully created To create a new volume group named new_vg, follow this example: ~]# vgcreate new_vg /dev/sdb1 If you create a new volume group, you won’t be able to expand or mirror any of your current volumes. To add it to an existing one, use vgextend. Now you can use the disk to create a new volume group, or add it to an existing one. Physical volume "/dev/sdb1" successfully created. The first is formatting the partition for use with LVM, the second is adding it to a volume group. Now that the disk has a partition table, adding it to LVM has two steps. Partition 1 of type Linux and of size 8 GiB is setĬhanged type of partition 'Linux' to 'Linux LVM'Ĭalling ioctl() to re-read partition table. ~]# fdisk /dev/sdbĬhanges will remain in memory only, until you decide to write them.īe careful before using the write command.ĭevice does not contain a recognized partition tableīuilding a new DOS disklabel with disk identifier 0x4507ff75. In the example, prompts with no inputs are where I accepted the default. Press the Enter key to accept the default option with fdisk. I will use fdisk to create a partition table on the new disk with a single LVM partition. Since /dev/sdb doesn’t have a partition table and doesn’t appear to be used, it is obviously the disk I just added. In the example below, I use lsblk to determine the device file of the new disk. I just powered up my CentOS 7 VM after adding a second virtual disk. Adding a partition table only takes a few seconds and only uses 512 bytes of space. LVM doesn’t require the disk to be partitioned, but I like to do it so I can use fdisk to see what the disk is for.

Perhaps you have a new host and wish to store your application’s data on volumes separate from the OS.
#Disk map to partition software#
Another possible scenario is adding another physical disk to create a software mirror. The typical scenario is you have a virtual machine (VM) that is running low on space, so you add another virtual disk to it. Adding a disk to LVM is pretty straightforward.
