linuxstoragelvm

Understanding LVM Basics on Linux

Understanding LVM Basics on Linux

  1. config Display and manipulate configuration information

  2. devtypes Display recognised built-in block device types

  3. dumpconfig Display and manipulate configuration information

  4. formats List available metadata formats

  5. help Display help for commands

  6. lvchange Change the attributes of logical volume(s)

  7. lvconvert Change logical volume layout

  8. lvcreate Create a logical volume

  9. lvdisplay Display information about a logical volume

  10. lvextend Add space to a logical volume

  11. lvmchange With the device mapper, this is obsolete and does nothing.

  12. lvmconfig Display and manipulate configuration information

  13. lvmdiskscan List devices that may be used as physical volumes

  14. lvmsadc Collect activity data

  15. lvmsar Create activity report

  16. lvreduce Reduce the size of a logical volume

  17. lvremove Remove logical volume(s) from the system

  18. lvrename Rename a logical volume

  19. lvresize Resize a logical volume

  20. lvs Display information about logical volumes

  21. lvscan List all logical volumes in all volume groups

  22. pvchange Change attributes of physical volume(s)

  23. pvresize Resize physical volume(s)

  24. pvck Check the consistency of physical volume(s)

  25. pvcreate Initialize physical volume(s) for use by LVM

  26. pvdata Display the on-disk metadata for physical volume(s)

  27. pvdisplay Display various attributes of physical volume(s)

  28. pvmove Move extents from one physical volume to another

  29. lvpoll Continue already initiated poll operation on a logical volume

  30. pvremove Remove LVM label(s) from physical volume(s)

  31. pvs Display information about physical volumes

  32. pvscan List all physical volumes

  33. segtypes List available segment types

  34. systemid Display the system ID, if any, currently set on this host

  35. tags List tags defined on this host

  36. vgcfgbackup Backup volume group configuration(s)

  37. vgcfgrestore Restore volume group configuration

  38. vgchange Change volume group attributes

  39. vgck Check the consistency of volume group(s)

  40. vgconvert Change volume group metadata format

  41. vgcreate Create a volume group

  42. vgdisplay Display volume group information

  43. vgexport Unregister volume group(s) from the system

  44. vgextend Add physical volumes to a volume group

  45. vgimport Register exported volume group with system

  46. vgmerge Merge volume groups

  47. vgmknodes Create the special files for volume group devices in /dev

  48. vgreduce Remove physical volume(s) from a volume group

  49. vgremove Remove volume group(s)

  50. vgrename Rename a volume group

  51. vgs Display information about volume groups

  52. vgscan Search for all volume groups

  53. vgsplit Move physical volumes into a new or existing volume group

  54. 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.