Understanding LVM Basics on Linux
- config Display and manipulate configuration information
- devtypes Display recognised built-in block device types
- dumpconfig Display and manipulate configuration information
- formats List available metadata formats
- help Display help for commands
- lvchange Change the attributes of logical volume(s)
- lvconvert Change logical volume layout
- lvcreate Create a logical volume
- lvdisplay Display information about a logical volume
- lvextend Add space to a logical volume
- lvmchange With the device mapper, this is obsolete and does nothing.
- lvmconfig Display and manipulate configuration information
- lvmdiskscan List devices that may be used as physical volumes
- lvmsadc Collect activity data
- lvmsar Create activity report
- lvreduce Reduce the size of a logical volume
- lvremove Remove logical volume(s) from the system
- lvrename Rename a logical volume
- lvresize Resize a logical volume
- lvs Display information about logical volumes
- lvscan List all logical volumes in all volume groups
- pvchange Change attributes of physical volume(s)
- pvresize Resize physical volume(s)
- pvck Check the consistency of physical volume(s)
- pvcreate Initialize physical volume(s) for use by LVM
- pvdata Display the on-disk metadata for physical volume(s)
- pvdisplay Display various attributes of physical volume(s)
- pvmove Move extents from one physical volume to another
- lvpoll Continue already initiated poll operation on a logical volume
- pvremove Remove LVM label(s) from physical volume(s)
- pvs Display information about physical volumes
- pvscan List all physical volumes
- segtypes List available segment types
- systemid Display the system ID, if any, currently set on this host
- tags List tags defined on this host
- vgcfgbackup Backup volume group configuration(s)
- vgcfgrestore Restore volume group configuration
- vgchange Change volume group attributes
- vgck Check the consistency of volume group(s)
- vgconvert Change volume group metadata format
- vgcreate Create a volume group
- vgdisplay Display volume group information
- vgexport Unregister volume group(s) from the system
- vgextend Add physical volumes to a volume group
- vgimport Register exported volume group with system
- vgmerge Merge volume groups
- vgmknodes Create the special files for volume group devices in /dev
- vgreduce Remove physical volume(s) from a volume group
- vgremove Remove volume group(s)
- vgrename Rename a volume group
- vgs Display information about volume groups
- vgscan Search for all volume groups
- vgsplit Move physical volumes into a new or existing volume group
- version Display software and driver version information
check the file system disk space usage and logical volume information: sudo df -h sudo lvs
Get the information about newly added hard disk using the following command: fdisk -l
To create the partition on the second Hard disk, use the following command and follow the “on screen” instructions and change the partition type from Linux to LVM (8e): fdisk /dev/sdb
Identify the already mounted lvm file system type: df -T
Format the newly created partition using the following command: sudo mkfs.ext4 /dev/sdb1
Initialize the newly created partition as a physical volume: sudo pvcreate /dev/sdb1
Check the volume groups using the following command: sudo vgs
Extend the VG (vg_centos6) with new PV (/dev/sdb1): sudo vgextend vg_centos6 /dev/sdb1
Extend the logical volume (lv_root) with all the free space of the VG(vg_centos6): sudo lvextend -l +100%FREE /dev/vg_centos6/lv_root
resize the file-system: sudo resize2fs /dev/vg_centos6/lv_root
Verify the file-system is larger using the following commands: sudo df -h sudo lvs sudo vgs
Enjoyed this post?
Get the next one in your inbox — only when I ship something worth reading.
Newsletter form not configured.
Or follow on Substack for the newsletter.
Comments via GitHub Discussions
Comments not configured. Set GISCUS env vars to enable.