Page 1 of 1

Is creating a partition necessary for LVM?

Posted: Thu Dec 21, 2017 3:56 am
by bhwong
This is how I used to do to add new virtual HDD into my HMS volume thru LVM:

After adding a new virtual HDD, I run a scan:

Code: Select all

echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan
If the above command is executed without any error messages prompted, run the next command:

Code: Select all

fdisk -l 
(The output will indicate new hard-disk that was added /dev/sdh etc)

The newly added hard-disk was then insert into the HSM's LVM volume with the following commands:

Code: Select all

pvcreate /dev/sdh
vgextend volgrp2 /dev/sdh
lvextend -L +250G /dev/volgrp2/hsmvol
However, my peer told me that I should create a partition first for the new HDD before adding it into the LVM volume: https://www.tecmint.com/extend-and-redu ... -in-linux/

After creating a partition, it will become /dev/sdh1:

Code: Select all

pvcreate /dev/sdh1
vgextend volgrp2 /dev/sdh1
lvextend -L +250G /dev/volgrp2/hsmvol

What is the difference and impact between having LVM using HDD with partition and without? Does this apply to both Ubuntu and CentOS?

Re: Is creating a partition necessary for LVM?

Posted: Thu Jan 18, 2018 6:48 am
by bhwong
Thanks for replying. That article was almost 8 years ago. Is it still relevant? The purpose of having partitions is to help expand the storage easily when required in the future.

Re: Is creating a partition necessary for LVM?

Posted: Thu Jan 18, 2018 6:55 am
by zimico
Hi bhwong,
This is a link from zimbra wiki: https://v-reality.info/2010/06/working- ... n-vsphere/.
If your intention is to use all of your new disk for single file system I recommend that you do not use partitioning, use a plain disk as LVM physical volume instead, it simplifies managing volumes a lot. If you need to use partitioning you should be aware of following caveats:
- To avoid performance penalty from file system misalignment you need to match beginning of new partition with underlying storage device using fdisk expert commands
- Using partitions makes extending file systems much more complicated compared to using plain disks instead
If you fail to align file system properly with your storage, you can lose even up to 15% of your available IOPS of your storage
Regards,
Minh

Re: Is creating a partition necessary for LVM?

Posted: Sat Jan 27, 2018 3:44 am
by zimico
In my opinion I will go with LVM and partitonless, using whole virtual disk.

Note that you should consider about LVM with multiple LUN when using SAN snapshot.

Regards,
Minh.

Re: Is creating a partition necessary for LVM?

Posted: Mon May 14, 2018 3:48 am
by bhwong
Thanks! If my existing LVM already have partitions, am I able to add and expand existing LVM without partition?

Re: Is creating a partition necessary for LVM?

Posted: Fri May 18, 2018 1:29 pm
by zimico
Hi. I haven't tried this. Could you set up a lab and let us know the result?
Regards.