Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the lvcreate command in a CentOS system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to use lvcreate commands in the CentOS system. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

Examples of four commonly used lvcreate commands

Logical Volume Management (LVM) is a widely used technology with extremely flexible disk management solutions. It mainly consists of three basic commands:

Create physical volumes using pvcreate

Create a volume group and add partition vgcreate to the volume group

Create a new logical volume using lvcreate

The following example focuses on creating logical volumes using lvcreate on an existing volume group. The lvcreate command allocates logical extensions in the available physical extension pool of the volume group. In general, logical volumes are free to use any space on the underlying logical volumes. Modifying a logical volume frees or reallocates space for the physical volume. These examples have been tested in CentOS 5, CentOS 6, CentOS 7, RHEL 5, RHEl 6 and RHEL 7 versions.

4 examples of lvcreate commands

Create a 15G logical volume in a volume group named vg_newlvm:

The code is as follows:

[root@centos7] # lvcreate-L 15G vg_newlvm

Create a logical volume of size 2500MB in the volume group named vgnewlvm and name it centos7newvol, thus creating the block device / dev/vgnewlvm/centos7newvol:

The code is as follows:

[root@centos7] # lvcreate-L 2500-n centos7_newvol vg_newlvm

You can use the argument-l of the lvcreate command to specify the size of the logical volume extension. You can also use this parameter to extend logical volumes as a percentage of the size of the volume group. The following command creates a 50% logical volume vgnewlvm of the centos7newvol volume group:

The code is as follows:

[root@centos7] # lvcreate-l 50%VG-n centos7_newvol vg_newlvm

Create a logical volume using all the space left in the volume group

The code is as follows:

[root@centos7] # lvcreate-- name centos7newvol-l 100%FREE vgnewlvm

For more help, use the lvcreate command-- help option to see:

The code is as follows:

[root@centos7] # lvcreate-- help

Lvcreate: Create a logical volume (create logical volume)

Lvcreate

[- A |-- autobackup {y | n}] (automatic backup)

[- a |-- activate [a | e | l] {y | n}]

[--addtag Tag] (add tags)

[--alloc AllocationPolicy] (allocation policy)

[--cachemode CacheMode] (Cache mode)

[- C |-- contiguous {y | n}]

[- d |-- debug]

[- h | -? |-- help]

[--ignoremonitoring] (ignore monitoring)

[--monitor {y | n}] (Monitoring)

[- I |-- stripes Stripes [- I |-- stripesize StripeSize]]

[- k |-- setactivationskip {y | n}]

[- K |-- ignoreactivationskip]

{- l |-- extents LogicalExtentsNumber [% {VG | PVS | FREE}] | (number of logical extensions)

-L |-- size LogicalVolumeSize [bBsSkKmMgGtTpPeE]} (logical volume size)

[- M |-- persistent {y | n}] [--major major] [--minor minor]

[- m |-- mirrors Mirrors [--nosync] [{--mirrorlog {disk | core | mirrored} |-- corelog}]] (image)

[- n |-- name LogicalVolumeName] (logical volume name)

[--noudevsync]

[- p |-- permission {r | rw}]

[--[raid] minrecoveryrate Rate]

[--[raid] maxrecoveryrate Rate]

[- r |-- readahead ReadAheadSectors | auto | none] (read header sector)

[- R |-- regionsize MirrorLogRegionSize] (mirror logical region size)

[- T |-- thin [- c |-- chunksize ChunkSize] (block size)

[--discards {ignore | nopassdown | passdown}]

[--poolmetadatasize MetadataSize [bBsSkKmMgG]]

[--poolmetadataspare {y | n}]

[--thinpool ThinPoolLogicalVolume {Name | Path}] (thin pool logical volume)

[- t |-- test]

[--type VolumeType] (volume type)

[- v |-- verbose]

[- W |-- wipesignatures {y | n}]

[- Z |-- zero {y | n}]

[--version]

VolumeGroupName [PhysicalVolumePath...]

This is how the lvcreate command shared by the editor is used in the CentOS system. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report