The lvcreate
command is used in Linux to create logical volumes in the Logical Volume Manager (LVM). This allows users to manage disk space more flexibly by creating, resizing, and deleting logical volumes as needed.
The basic syntax of the lvcreate
command is as follows:
lvcreate [options] [arguments]
-n, --name <name>
: Specifies the name of the logical volume to create.-L, --size <size>
: Defines the size of the logical volume.-l, --extents <number>
: Sets the size of the logical volume in extents.-C, --mirrors <number>
: Creates a mirrored logical volume with the specified number of mirrors.-Z, --zeroing <y/n>
: Specifies whether to zero the logical volume before use.lvcreate -n my_volume -L 10G my_volume_group
lvcreate -n my_extent_volume -l 100 my_volume_group
lvcreate -n my_mirror_volume -m 1 -L 20G my_volume_group
lvcreate -n my_zeroed_volume -L 15G -Z y my_volume_group
-Z y
option to zero the volume if you plan to use it for sensitive data, as this can help prevent data remnants from being left behind.