• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lvm Command Examples in Linux

by Deepika

The lvm command is used to manage physical volumes, volume groups, and logical volumes in a Linux Logical Volume Manager (LVM) system. The lvm command launches an interactive shell, allowing you to perform various LVM management operations.

Physical volumes (PVs) represent the actual storage devices, such as hard drives or solid-state drives, in a LVM system. Volume groups (VGs) are collections of physical volumes that are used to create logical volumes (LVs). LVs are virtual partitions on a VG that can be resized, moved, and otherwise managed without affecting the underlying physical storage.

With the lvm shell, you can perform a wide range of LVM management tasks, including:

  • Creating and deleting physical volumes
  • Creating and deleting volume groups
  • Creating and deleting logical volumes
  • Extending and reducing the size of logical volumes
  • Moving logical volumes between physical volumes
  • Displaying information about physical volumes, volume groups, and logical volumes And more.

The lvm shell provides a convenient and powerful way to manage LVM storage in Linux, allowing you to dynamically allocate, manage, and reconfigure storage as needed.

lvm Command Examples

1. Start the Logical Volume Manager interactive shell:

# lvm

2. List the Logical Volume Manager commands:

# lvm help

3. Initialize a drive or partition to be used as a physical volume:

# lvm pvcreate /dev/sdXY

4. Display information about physical volumes:

# lvm pvdisplay

5. Create a volume group called vg1 from the physical volume on `/dev/sdXY`:

# lvm vgcreate vg1 /dev/sdXY

6. Display information about volume groups:

# lvm vgdisplay

7. Create a logical volume with size 10G from volume group vg1:

# lvm lvcreate -L 10G vg1

8. Display information about logical volumes:

# lvm lvdisplay

Filed Under: Linux

Some more articles you might also be interested in …

  1. Beginners guide to vi editor (command line reference)
  2. CentOS / RHEL 7 : How to install kernel from rescue mode
  3. cpufreq-set : command not found
  4. setsebool: command not found
  5. tvservice: command not found
  6. bspc: command not found
  7. “BAD PASSWD : is too simple” – error during password change in CentOS/RHEL 7 and 8
  8. unzip: command not found
  9. Sample /etc/services file in Linux
  10. Set FTP Autologin with .netrc file in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • csslint: A linter for CSS code
  • csh: The shell (command interpreter) with C-like syntax (Command Examples)
  • csc: The Microsoft C# Compiler (Command Examples)
  • crystal: Tool for managing Crystal source code

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright