| Tested on | Ubuntu 25.04 (Plucky Puffin) |
|---|---|
| Package | lvm2lvm2 |
| Applies to | Ubuntu, Debian, RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora, Arch Linux, SUSE, openSUSE, Alpine |
| Privilege | sudo or root |
| Man page | lvcreate(8) |
| Scope | lvcreate allocates logical volumes from free extents in a volume group. Create linear volumes, snapshots, and size-by-percentage LVs before you mkfs and mount. |
| Related guides | vgcreate command cheat sheet LVM snapshot backup tutorial lvchange lvdisplay Linux commands |
lvcreate — quick reference
Linear logical volumes
The default LV type — one contiguous or scattered segment in the VG.
| When to use | Command |
|---|---|
| Create a named LV with absolute size | sudo lvcreate -L 100M -n mylv myvg |
| Same with long options | sudo lvcreate --size 100M --name mylv myvg |
| Size as percentage of total VG space | sudo lvcreate -l 50%VG -n mylv myvg |
| Use all remaining free extents | sudo lvcreate -l 100%FREE -n mylv myvg |
| Use a fraction of remaining free space | sudo lvcreate -l 25%FREE -n mylv myvg |
| Pin initial extents to specific PVs | sudo lvcreate -L 64M -n mylv myvg /dev/sdX1 |
Snapshots
Point-in-time copy-on-write view of an origin LV — common for backups.
| When to use | Command |
|---|---|
| Snapshot LV with fixed size | sudo lvcreate -s -L 32M -n snap myvg/origin |
| Snapshot with long options | sudo lvcreate --snapshot -L 32M --name snap myvg/origin |
Striped volumes (multi-PV VG)
Requires at least as many PVs as stripes.
| When to use | Command |
|---|---|
| Striped LV (example: 2 stripes) | sudo lvcreate -i 2 -I 64 -L 64M -n strip myvg |
| Set stripe size in kilobytes | sudo lvcreate --stripes 2 --stripesize 64 -L 64M -n strip myvg |
Help and version
| When to use | Command |
|---|---|
| Show built-in usage | lvcreate --help |
| List LVs after creation | sudo lvs myvg |
lvcreate — command syntax
Linear LV synopsis from lvcreate --help on Ubuntu 25.04 (LVM 2.03.27):
lvcreate -L|--size Size[m|UNIT] VG
[ -n|--name String ]
[ -l|--extents Number[PERCENT] ]
[ --type linear ] (implied)
[ PV ... ]
lvcreate -s|--snapshot -L|--size Size[m|UNIT] -n|--name String VG/LVlvcreate consumes free extents in the VG and registers /dev/VG/LV (and /dev/mapper/VG-LV). Needs sudo. Advanced types (--type raid5, thin pools, caches) need extra PVs or packages — see the man page; this cheat sheet focuses on everyday linear and snapshot flows shown in the examples below.
lvcreate — command examples
Essential Build PV, VG, then a linear LV
The walkthrough builds a practice stack (labvg on a loop device) so you can repeat the steps safely.
fallocate -l 256M /tmp/lvm-lab-a.img
LOOP_A=$(sudo losetup -fP --show /tmp/lvm-lab-a.img)
sudo pvcreate $LOOP_A
sudo vgcreate labvg $LOOP_A
sudo lvcreate -L 64M -n datalv labvg
sudo lvs labvgSample output:
Logical volume "datalv" created.
LV VG Attr LSize
datalv labvg -wi-a----- 64.00mFormat and mount when ready: sudo mkfs.ext4 /dev/labvg/datalv.
Essential Remove lab LVs and VG
sudo lvremove -f labvg
sudo vgremove -f labvg
sudo pvremove -f $LOOP_A $LOOP_B
sudo losetup -d $LOOP_A $LOOP_B 2>/dev/null
rm -f /tmp/lvm-lab-*.imgCommon Size an LV as a percentage of the VG
-l 20%VG takes twenty percent of the VG's total extent count — not twenty percent of free space.
sudo lvcreate -l 20%VG -n pctlv labvg
sudo lvs -o lv_name,lv_size,vg_name labvgSample output:
Logical volume "pctlv" created.
LV LSize VG
datalv 64.00m labvg
pctlv 48.00m labvgOn a 252 MiB lab VG, 20% is 48 MiB after extent rounding.
Common Use remaining free extents with 100%FREE
Handy for "use whatever is left" after other LVs exist.
sudo lvcreate -l 100%FREE -n freelv labvg
sudo vgs -o vg_name,vg_free labvgSample output:
Logical volume "freelv" created.
VG VFree
labvg 0All free extents are now assigned to freelv.
Common Create a snapshot of an origin LV
Snapshots need extra space in the VG for changed blocks. Size the snapshot LV large enough for your write rate during the backup window.
sudo lvcreate -s -L 16M -n snaplv labvg/datalv
sudo lvs labvgSample output:
Logical volume "snaplv" created.
LV VG Attr LSize Origin Data%
datalv labvg owi-a-s--- 64.00m
snaplv labvg swi-a-s--- 16.00m datalv 0.00Origin shows datalv; Data% grows as the origin changes.
Common Non-aligned size rounds up to extent boundary
LVM allocates whole extents (4 MiB by default). Requesting 50 MiB may become 52 MiB.
sudo lvcreate -L 50M -n roundlv labvg
sudo lvs -o lv_name,lv_size labvg/roundlvSample output:
WARNING: ... rounded up to 52.00 MiB.
Logical volume "roundlv" created.
LV LSize
roundlv 52.00mPlan sizes in extent multiples to avoid surprises.
Advanced Striped LV on a two-PV volume group
Striping needs at least -i physical volumes in the VG. Add a second PV first.
fallocate -l 256M /tmp/lvm-lab-b.img
LOOP_B=$(sudo losetup -fP --show /tmp/lvm-lab-b.img)
sudo pvcreate $LOOP_B
sudo vgextend labvg $LOOP_B
sudo lvcreate -i 2 -L 64M -n stripelv labvg
sudo lvs -o lv_name,segtype,stripes labvg/stripelvSample output:
Logical volume "stripelv" created.
LV SegType Stripes
stripelv striped 2If -i exceeds PV count, lvcreate errors out.
Advanced Error when the VG is full
When free extents are gone, lvcreate refuses — extend the VG with vgextend or remove LVs.
sudo lvcreate -L 1G -n toobig labvgSample output:
Volume group "labvg" has insufficient free space (0 extents): 256 required.Free space with vgs or vgdisplay before creating large LVs.
lvcreate — when to use / when not
| Use lvcreate when | Use something else when |
|---|---|
|
lvcreate vs lvextend
| lvcreate | lvextend | |
|---|---|---|
| Purpose | New LV name | Grow existing LV |
| Free space | Takes new extents | Adds extents to current LV |
| Filesystem | Does not resize FS | Often paired with resize2fs |
lvcreate — interview corner
How do you create a 10 GiB logical volume named data in myvg?
sudo lvcreate -L 10G -n data myvgUse -n / --name for the LV name and -L for absolute size. Verify with lvs myvg/data.
A strong answer is:
"lvcreate -L 10G -n data myvg — then mkfs and mount /dev/myvg/data."
What does lvcreate -l 100%FREE do?
It allocates all unassigned extents in the VG to the new LV — useful for consuming leftover space after other LVs are created.
A strong answer is:
"100%FREE creates an LV from every remaining free extent in the volume group."
Why must snapshot LVs be sized?
Snapshots are copy-on-write — they store blocks that change on the origin. If the snapshot fills, it becomes invalid. Size for peak write activity during the snapshot lifetime.
A strong answer is:
"Snapshots need their own space for changed blocks — I size them for expected churn during the backup window."
How many PVs do you need for -i 2 striping?
At least two PVs in the VG. Stripe count cannot exceed PV count.
A strong answer is:
"Stripes need matching PVs — -i 2 requires two PVs in the VG via vgcreate or vgextend."
What device path appears after lvcreate?
/dev/VG/LV and /dev/mapper/VG-LV (hyphenated). Either path works for mkfs and /etc/fstab (UUID preferred).
A strong answer is:
"/dev/myvg/mylv and /dev/mapper/myvg-mylv — I still mount by UUID in fstab."
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
insufficient free space |
VG full | vgs, lvremove unused LVs, or vgextend |
| Size rounded up with WARNING | Not extent-aligned | Use multiples of extent size (often 4M) |
number of stripes cannot exceed |
Too few PVs | vgextend or lower -i |
| Snapshot instantly full | Snapshot too small | Create larger snapshot or reduce origin writes |
unknown option for raid/thin flags |
Feature or deps missing | lvcreate --help; install extras or use supported types |
