What it does lvcreate -n NAME -L SIZE VG makes an LV; -l gives the size in extents or percent (-l 100%FREE). The new device is /dev/VG/NAME; put a file system on it and mount it.
lvcreate also makes snapshots (-s), thin pools and thin volumes (-T), striped, mirrored and RAID volumes, cache and VDO volumes (with --type).
How to write it lvcreate -n NAME (-L SIZE | -l EXTENTS) [OPTION]... VG [PV...]
lvcreate -s -n NAME -L SIZE VG/LV
lvremove [OPTION]... VG/LV... Most used
Basic -n, --name NAMEName of the new LV. -L, --size SIZESize, like 500M, 5G. -l, --extents N[%VG|%FREE|%PVS|%ORIGIN] Size in extents or percent, like 50, 100%FREE. -a, --activate y|n|ayActivate it (default y). -p, --permission rw|rRead-write or read-only. -C, --contiguous y|nUse one contiguous area. --alloc POLICYAllocation policy. -r, --readahead auto|none|NRead-ahead sectors. -Z, --zero y|nZero the first KiB (default y). -W, --wipesignatures y|nWipe old signatures on the new LV. -k, --setactivationskip y|n, -K, --ignoreactivationskip, --setautoactivation y|nActivation settings. -M, --persistent y|n, -j, --major N, --minor NFixed device numbers. Types --type TYPElinear, striped, snapshot, raid0/1/4/5/6/10, mirror, thin, thin-pool, cache, writecache, vdo … -s, --snapshotCreate a snapshot of an LV. -T, --thinThin pool or thin volume. --thinpool LVThe thin pool for a thin volume. -V, --virtualsize SIZEVirtual size of a thin volume. -c, --chunksize SIZEChunk size (snapshot, thin, cache). --discards passdown|nopassdown|ignoreDiscard behaviour of thin pools. --errorwhenfull y|nFail writes when a thin pool is full. -i, --stripes NSpread over N PVs (striped). -I, --stripesize SIZEStripe size. -m, --mirrors NNumber of extra copies (mirror/raid1). -R, --regionsize SIZE, --mirrorlog core|disk, --nosyncMirror settings. --raidintegrity y|n, --raidintegritymode MODE, --raidintegrityblocksize N, --maxrecoveryrate SIZE, --minrecoveryrate SIZERAID settings. --vdo, --vdopool LV, --compression y|n, --deduplication y|nVDO (deduplication and compression). --monitor y|n, --ignoremonitoringdmeventd monitoring. --noudevsyncDo not wait for udev. lvremove -f, --forceRemove without asking (also active LVs). -S, --select EXPRRemove LVs that match. Common LVM options -t, --testTest only; change nothing. -v, --verboseMore output (repeat for more). -y, --yesAnswer yes to questions. --config STRINGOverride lvm.conf settings for this command only. --commandprofile STRING, --profile STRINGUse a configuration profile. --devices PV, --devicesfile STRINGLimit the devices LVM looks at. --driverloaded y|n, --nolocking, --lockopt STRING, --nohints, --journal STRINGSpecial and debug settings. -h, --help, --longhelpShow help. --versionShow the version. Nothing matches this filter.
$ run as a normal user# run as root (or with sudo)
1 LV with a size Copy # lvcreate -n lvdata -L 5G vgdata
Logical volume "lvdata" created. Device: /dev/vgdata/lvdata.
2 LV with a number of extents Copy # lvcreate -n lvfiles -l 50 vgfiles50 × PE size (see vgdisplay).
3 Use all free space Copy # lvcreate -n lvweb -l 100%FREE vgdataOr 50%FREE for half.
4 File system and mount The usual next steps.
5 A swap LV Copy # lvcreate -n lvswap -L 2G rhel; mkswap /dev/rhel/lvswapAdd it to fstab as swap.
6 Snapshot for a backup Copy # lvcreate -s -n lvdata-snap -L 1G /dev/vgdata/lvdata
# mount -o ro,nouuid /dev/vgdata/lvdata-snap /mntFrozen view; back up /mnt, then remove the snapshot. (nouuid is needed for XFS.)
7 Thin pool and thin volume Copy # lvcreate -T -L 10G vgdata/pool1
# lvcreate -T -V 50G -n lvthin vgdata/pool1Over-provisioning: watch the pool usage!
8 Place an LV on a chosen PV Copy # lvcreate -n lvfast -L 2G vgdata /dev/nvme0n1p3For example on the faster disk.
9 Remove an LV Copy # umount /data; lvremove /dev/vgdata/lvdata
Do you really want to remove active logical volume vgdata/lvdata? [y/n]: y Remove the fstab line too.
10 RAID1 mirror LV Copy # lvcreate --type raid1 -m 1 -n lvsafe -L 2G vgdataTwo copies on different PVs.
Nothing matches this filter.