Create LVM without partition table
Earlier I had written a blog to create LVM using partition table Create File system with Linux LVM
In this blog, I will show you how to create LVM without using partition table. This is useful when you want to use a full disk for the volume instead of portion of the disk.
This procedure will be relevant to the data disk that you will add to your system rather than the OS Disk/Partition. Also its very helpful in later stage when you need to extend the same disk instead of adding new disk in the virtual environment/cloud, LVM without partition will be very easy to handle as you can directly resize your PV and LV instead of destroying and recreating the disk and partition table.
Lets go with creating the disk after adding new disk on vm. We have covered about how to re-scan the scsi bus in the earlier blog - Create File system with Linux LVM
To rescan the new disk - my setup has the new disk in host2 adapter.
#echo "- - -" /sys/class/scsi_host/host2/scan
![]() |
1.1 Scanning SCSI Host adapter |
We have now got a new disk that we added on the VM that is /dev/sdb, Let's continue to create this disk as physical volume directly instead of create a partition table with parted or fdisk.
#pvcreate /dev/sdb
Syntax - pvcreate disk_name/partition_name
![]() |
1.2 Create PV |
To create Volume Group(VG) on this new PV, you need to use vgcreate command,
#vgcreate data_vg /dev/sdb
Where data_vg is the volume group name.
Syntax - vgcreate VG_new PV1 PV2 ...
![]() |
1.3 Create VG |
LV can be created on top of this VG using lvcreate comamnd,
Syntax - lvcreate -l +100%FREE -n LV_name vg_name
From lsblk you can see that lvm is created successfully.
![]() |
1.5 lsblk output |
Now you can create Filesystem to this Logical volume and mount it as per your requirement.
I have formatted with XFS and mounted to /data mount point.
![]() |
1.6 XFS Format |
I will write procedure to extend same disk and LV without having downtime in another blog.
No comments:
Post a Comment