C Shell Wiki
Posts (Latest 10 updated) :
Read all
Contents:
  1. [Linux] C Shell (csh) lvcreate用法: Create logical volumes in LVM
    1. Overview
    2. Usage
    3. Common Options
    4. Common Examples
    5. Tips

[Linux] C Shell (csh) lvcreate用法: Create logical volumes in LVM

Overview

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.

Usage

The basic syntax of the lvcreate command is as follows:

lvcreate [options] [arguments]

Common Options

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

Common Examples

  1. Create a simple logical volume:
    lvcreate -n my_volume -L 10G my_volume_group
    
  2. Create a logical volume with extents:
    lvcreate -n my_extent_volume -l 100 my_volume_group
    
  3. Create a mirrored logical volume:
    lvcreate -n my_mirror_volume -m 1 -L 20G my_volume_group
    
  4. Create a logical volume and zero it:
    lvcreate -n my_zeroed_volume -L 15G -Z y my_volume_group
    

Tips

  • Always ensure that you have enough free space in your volume group before creating a new logical volume.
  • Use descriptive names for your logical volumes to make management easier.
  • Consider using the -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.