LVM (Logical Volume) commands

LVM2 command lines for the three layers of the Linux Logical Volume Manager, physical volumes, volume groups and logical volumes, taken from the manual pages of LVM tools 2.03.42(2)-git on man7.org. Rows are whole commands grouped by task, from the first pvcreate /dev/sdc4 /dev/sde to thin pools, RAID and caching. Names such as vg00 or /dev/sdb1 come from the manual's examples; VG, LV, PV and Size are placeholders. Environment variables and the lvmlockd shared-VG options are left out.

191 commands in 11 sections. Checked row by row against lvm(8) manual page, LVM tools 2.03.42(2)-git (2026-05-15), man7.org on . Edited by Jay.

Inspecting 30

The manual calls pvs, vgs and lvs the preferred alternative to the display commands: the same information and more, in a compact and configurable format.

CommandWhat it does
pvsReport physical volumesOne line per PV with its VG, format, attributes, size and free space.
pvs -aInclude devices that are not PVsAlso lists devices that LVM has not initialised.
pvs --segmentsReport physical volume segmentsAdds one line per segment with its start extent and length.
pvs --segments -o+lv_name,seg_start_pe,segtypeMap physical extents to LVsShows which logical volume and segment type sits on each extent range of a PV.
pvdisplayShow physical volume detailsVerbose multi-line form; the manual calls pvs the preferred, more compact alternative.
pvdisplay -mShow extent mapping of a PVAdds the map from each physical extent range to the LV and logical extents stored there.
vgsReport volume groupsOne line per VG with PV, LV and snapshot counts, attributes, size and free space.
vgs -o systemid VGShow a volume group's system IDTells you whether a system ID has been stored on that VG.
vgdisplayShow volume group detailsVerbose form that also covers the associated PVs and LVs; vgs is the preferred compact report.
vgdisplay --partial --verboseList missing physical volumesGives UUID and size of every PV that has gone missing, the input for replacing it.
lvsReport logical volumesOne line per LV with its VG, attributes, size, pool, origin and sync percentage.
lvs -aInclude hidden logical volumesAdds internal component LVs, whose names are printed in square brackets.
lvs --segmentsReport logical volume segmentsOne line per segment with stripe count, segment type and segment size.
lvs -o lv_name,lv_sizeChoose the report columnsReplaces the configured field list with the named fields for this run.
lvs -o+lv_layoutAdd a column to the reportA plus sign appends the field to the default columns instead of replacing them.
lvs -o-originRemove a column from the reportA minus sign drops the named field from the default columns.
lvs -o helpList available report fieldsPrints every field name the report accepts; pvs and vgs take the same option.
lvs -S helpShow selection syntax helpLists the fields usable in -S selection criteria, each with its type.
lvs -o name,size,snap_percent -S 'size=8m'Filter rows by a field valueKeeps only LVs that match; sizes are read as MiB when no unit is given.
lvs --units b --nosuffixPrint sizes as plain bytesOverrides the human-readable default: byte counts with no unit suffix.
lvs --noheadingsOmit the heading lineLeaves only the data rows, without the column titles.
lvs -o lv_name,lv_size --reportformat jsonReport in JSONSwitches from the basic table to JSON output; json_std is the other structured format.
lvdisplayShow logical volume detailsVerbose form with size, read/write status and snapshot information; lvs is the preferred report.
lvdisplay -mShow extent mapping of an LVAdds the map from logical extents to the PVs and physical extents that hold them.
lvdisplay vg0Show every LV in a volume groupNaming a VG where LVs are expected applies the command to all of its LVs.
pvscanList physical volumesRead-only listing when run without --cache; with that option it updates runtime LVM state instead.
vgscanScan for volume groupsSearches every supported block device on the system for VGs.
lvscanList all logical volumesOne line per LV: active or not, snapshot or origin, device size and allocation policy.
lvmdiskscanScan devices for LVM labelsDeprecated: the manual says to use pvs instead.
lvm fullreportReport all layers at onceGathers PV, VG, LV and segment data per VG under one lock, so the figures agree with each other.

Physical volumes 8

CommandWhat it does
pvcreate /dev/sdc4 /dev/sdeInitialise devices as PVsLabels one partition and one whole disk so that both can join a volume group.
pvcreate --dataalignmentoffset 7s /dev/sdbShift the start of the data areaFor 4 KiB-sector drives that compensate for Windows partitioning, so LVM data stays aligned.
pvresize /dev/sda1Grow a PV to fill its deviceRun it once the partition has been enlarged so LVM sees the added space.
pvresize --setphysicalvolumesize 40G /dev/sda1Shrink a PV to a set sizeDo this before shrinking the partition, with a size that fits the new partition.
pvchange -x n /dev/sdk1Stop new allocations on a PVFor a disk with errors, or one that will be emptied and removed; y allows allocation again.
pvck PVCheck PV metadata
pvck --dump headers PVPrint on-disk LVM headersPrints label, PV and metadata-area headers with warnings for wrong values; other dump targets print the metadata text.
pvck --labelsector 204800 /dev/sdaScan a sector for a labelFor a lost partition table: 204800 is the 512-byte sector at 100 MiB.

Volume groups 16

CommandWhat it does
vgcreate myvg /dev/sdk1 /dev/sdl1Create a volume groupBuilds a VG from two PVs; the extent size stays at its default unless -s is given.
vgcreate -s Size VG_new PVSet the physical extent sizeChoose it at creation: afterwards it is hard to change without recreating the VG.
vgextend vg00 /dev/sda4 /dev/sdn1Add PVs to a volume groupDevices not yet prepared with pvcreate are initialised by vgextend itself.
vgrename vg02 myvgRename a volume group
vgrename Zvlifi-Ep3t-e0Ng-U42h-o0ye-KHu1-nl7Ns4 myvgRename a VG chosen by UUIDThe way out when two visible VGs carry the same name, e.g. after moving disks between machines.
vgchange -l 128 vg00Set the maximum LV countChanges the limit on logical volumes; the example VG is inactive.
vgmerge -v databases vg00Merge two volume groupsFolds the inactive vg00 into databases and prints verbose progress.
vgsplit VG VG PVSplit PVs off into another VGMoves whole PVs from the first VG to the second, creating the destination when it does not exist.
vgsplit -n LV VG VGSplit off the PVs under an LVMoves the PVs that hold the named LV; an LV cannot be divided between the two groups.
vgexport VGExport a volume groupPuts the VG offline until it is imported, e.g. before moving its disks; every LV in it must be inactive.
vgexport -aExport all volume groups
vgimport VGImport an exported volume groupMakes the VG usable again and sets its system ID to that of the importing host.
vgimport -aImport all exported VGs
vgimportclone --basevgname vg00_snap /dev/sdc /dev/sddImport and rename a cloned VGFor hardware snapshots of PVs: the copy gets a new VG name and new UUIDs so it can coexist with the original.
vgckCheck volume group metadata
vgck --updatemetadata VGRewrite VG metadataCorrects problems such as an old metadata copy on a PV that was missing and has come back.

Creating logical volumes 8

CommandWhat it does
lvcreate -L Size VGCreate a linear LVThe basic form; sizes are in MiB unless a unit follows, and without -n the LV is named lvol#.
lvcreate -L 64m -n mylv vg00 /dev/sda:0-7 /dev/sdb:0-7Create an LV on chosen extentsPlaces a named 64 MiB linear volume on extents 0-7 of two PVs.
lvcreate -l 100%FREE -n mylv vg00Take all unallocated spaceThe -l option counts extents or takes a percentage; %FREE is the space still unallocated in the VG.
lvcreate -i 3 -I 8 -L 100m vg00Create a striped LVThree stripes with an 8 KiB stripe size; with no -n, lvcreate picks the name.
lvcreate --vdo --size 10G --name vdo0 vg00/vpool1Create a VDO volumeMakes the VDO LV vdo0 together with its 10 GiB VDO pool vpool1.
lvrename /dev/vg02/lvold vg02/lvnewRename a logical volume
lvrename vg02 lvold lvnewRename an LV, VG named firstAlternate syntax: the VG once, then the old and the new LV name.
lvchange -pr vg00/lvol1Make an LV read-onlyChanges the permission attribute; rw makes the volume writable again.

Resizing 10

Wherever a row uses -L with a size, the manual allows -l with an extent count or a percentage such as 50%VG or 100%FREE instead.

CommandWhat it does
lvextend -L +54 vg01/lvol10 /dev/sdk3Grow an LV by a sizeAdds 54 MiB, allocated from the PV named last.
lvextend vg01/lvol01 /dev/sdk3Grow an LV onto a whole PVWith no size given the LV takes all free space on that PV, the same as -l +100%PVS.
lvextend -L+16m vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9Grow an LV on chosen extentsAdds 16 MiB taken from the listed extent ranges of two PVs.
lvextend -l+100%FREE -r vg01/lvol01Use all free space, resize filesystemTakes everything left in the VG and has fsadm grow the file system in the same run.
lvextend --usepolicies LVExtend by the configured policyExtends as the policy set in lvm.conf or a profile dictates; for snapshots and thin pools.
lvreduce -l -3 vg00/lvol1Shrink an LV by extentsRemoves three logical extents; data in the removed area is lost, so shrink the file system first.
lvreduce -r -L Size LVShrink LV and filesystem togetherWith -r, fsadm resizes the file system in step with the LV; a minus prefix makes the size relative.
lvresize -L+16M vg1/lv1 /dev/sda:0-1 /dev/sdb:0-1Resize an LV on chosen extentslvresize works like lvextend and lvreduce in one command; here it adds 16 MB from two extent ranges.
lvresize -l50%VG vg1/lv1Size an LV by VG percentageSets the LV to half of the volume group's total size.
lvresize -r -L Size LVResize LV and filesystem togetherTakes a + or - prefix for relative sizes, and -r hands the file system to fsadm.

Snapshots 6

CommandWhat it does
lvcreate --snapshot --size 100m --name mysnap vg00/mylvCreate a COW snapshotA frozen image of vg00/mylv, usable for backups while the origin stays in use.
lvcreate -s -l 20%ORIGIN -n mysnap vg00/mylvSize a snapshot by origin shareRoom to overwrite a fifth of the origin; 100%ORIGIN would cover the whole volume.
lvcreate --snapshot --virtualsize 1t --size 100m --name mylv vg00Create a sparse LVPresents 1 TiB to its users while allocating a little less than 100 MiB.
lvconvert --mergesnapshot LVMerge a snapshot into its originStarts at once if origin and snapshot are closed; otherwise it waits for the next activation.
lvconvert --splitsnapshot LVDetach a snapshot from its originThe split-off LV holds only the chunks that differ, plus the metadata describing them.
lvconvert --type snapshot LV LVReattach a split snapshotReverses a split: the first argument is the former origin, the second the former snapshot.

Thin provisioning 25

CommandWhat it does
lvcreate --type thin-pool -n pool0 -L 500M vgCreate a thin poolThe size applies to the pool's data LV; the metadata LV is sized automatically.
lvcreate --type thin -n vol -V 1G --thinpool pool0 vgCreate a thin LV in a poolThe virtual size may be larger than the physical space the pool has.
lvcreate --type thin -n vol -V 1G --thinpool pool0 -L500M vgCreate pool and thin LV togetherOne command: first a 500 MiB pool named pool0, then a 1 GiB thin LV inside it.
lvcreate -T -V 1T --size 256G --name mythin vg00/tpool0Create a thin LV with -TShort form of the combined command: a 256 GiB pool tpool0 and a 1 TiB thin volume.
lvcreate --type thin-pool -n pool0 -L5G --pooldatavdo y vgCreate a thin pool on VDOData of every thin LV in the pool is compressed and deduplicated by dm-vdo.
lvconvert --type thin-pool --poolmetadata pool0_meta vg/pool0Combine two LVs into a thin poolErases both LVs; the pool keeps the name and size of the data LV.
lvconvert --type thin vg/volConvert a thick LV to thinBuilds a new pool around the existing data; the conversion cannot be reversed.
lvcreate --snapshot -n snap1 vg/volSnapshot a thin LVNo size is given: adding one would create a COW snapshot instead of a thin one.
lvcreate --snapshot -n snap --thinpool pool0 vg/volThin snapshot of an external LVThe origin must be read-only and inactive; writes to the snapshot land in the named pool.
lvconvert --merge vg/snapMerge a thin snapshot backThe origin takes the snapshot's content and the snapshot disappears; delayed while the LVs are open.
lvchange -ay -K VG/SnapLVActivate a thin snapshotThin snapshots carry the skip-activation property, so a plain -ay passes over them unless -K is added.
lvchange --setactivationskip n VG/SnapLVClear the skip-activation propertyAfterwards -K is no longer needed to activate that thin LV.
lvextend -L+100M vg/pool0Grow a thin poolExtends the pool's data LV; the metadata LV grows too when the new size calls for it.
lvextend -L+100M --poolmetadatasize 8M vg/pool0Grow pool data and metadataRequests an explicit metadata size while the data LV is extended.
lvextend --poolmetadatasize MetadataSize VG/ThinPoolGrow only the pool metadata
lvextend --use-policies VG/ThinPoolRun the autoextend checkThe command dmeventd issues: it compares usage with the autoextend threshold and extends data or metadata if needed.
lvs -o data_percent VG/ThinPoolShow thin pool data usageExtend the pool before this figure, or the metadata one, reaches 100%.
lvs -o metadata_percent VG/ThinPoolShow thin pool metadata usageShare of the metadata LV that the dm_thin_pool module currently uses.
lvs -o+seg_monitor VG/ThinPoolCheck that a pool is monitoredAutomatic extension only works while dmeventd monitors the pool.
lvchange --monitor y VG/ThinPoolStart monitoring a thin pool
lvs -o whenfull VG/ThinPoolShow the when-full behaviourReads error or queue: what a pool that has run out of space does with writes.
lvchange --errorwhenfull y VG/ThinPoolFail writes when the pool is fullA full pool then returns write errors immediately; n queues the writes for a period instead.
lvchange --discards nopassdown VG/ThinPoolChange the discards modeDiscards are processed in the pool but not passed to the underlying device; passdown is the default.
lvchange -Z n VG/ThinPoolTurn off zeroing in a poolNewly provisioned chunks are no longer overwritten with zeros; zeroing large chunks reduces performance.
lvconvert --repair VG/ThinPoolRepair thin pool metadataNeeded when thin_check finds damage and the pool will not activate; not always successful.

RAID and cache 34

CommandWhat it does
lvcreate --type raid1 -m1 -L 500m -n mylv vg00Create a RAID1 LVTwo images on two devices, each of which also carries RAID metadata.
lvcreate --type raid5 -L 5G -i 3 -I 64 -n mylv vg00Create a RAID5 LVThree data stripes of 64 KiB on four devices, one of them for parity.
lvcreate --type raid10 -L 5G -i 2 -m 1 -n mylv vg00Create a RAID10 LVStriping over two mirrored pairs: -i counts stripes, -m counts images beyond the first.
lvcreate --config allocation/raid_stripe_all_devices=1 --type raid5 -l 100%FREE -n mylv vg00Create RAID5 across every PVUses all free space and spans all PVs; fails when the VG has more than 8 PVs.
lvcreate --type mirror -m1 -L 500m -n mylv vg00Create a mirror-type LVNeeds three devices: two for the images and one for the disk log.
lvs -o name,segtype LVShow an LV's RAID levelThe segment type column names the LV type, which corresponds to the RAID level.
lvs -a -o name,segtype,devicesShow RAID sub-LVs and devicesThe -a option is needed because image and metadata sub-LVs are hidden.
lvs -a -o name,sync_percentShow RAID sync progressA Cpy%Sync value of 100% means synchronisation has finished.
lvchange --syncaction check LVScrub a RAID LVRead-only pass that only detects inconsistent areas.
lvchange --syncaction repair LVScrub and correct a RAID LVChecks every block and rewrites the bad ones so inconsistent areas match again.
lvs -o name,raid_mismatch_countCount scrub mismatchesRun it when scrubbing has finished to see how many inconsistent blocks turned up.
lvs -o name,lv_health_statusShow RAID health statusReads partial when devices are missing from the LV.
lvchange -ay --activationmode degraded LVActivate a degraded RAID LVActivates with devices missing only when the RAID level can lose them without losing data.
lvconvert --repair LVReplace failed RAID devicesUse when the failed device has vanished from the system; new PVs may be listed last.
lvconvert --replace /dev/sdb1 vg/lvol1 /dev/sdf1Swap a PV in a RAID LVFor a device that is still visible; repeat --replace to swap several PVs at once.
lvchange --refresh vg/lvRefresh a RAID LVClears transient device failures and brings the LV back to full redundancy.
lvchange --rebuild PV LVRebuild data on a RAID PVFor PVs known to hold corrupt data; repeat the option to cover several PVs.
lvconvert --raidintegrity y LVAdd integrity checksumsPuts a dm-integrity layer on each RAID image so corrupted reads are served from a good image.
lvconvert --type raid1 --mirrors 1 vg/lvol1Convert linear to RAID1Adds one image to a linear volume, which makes it a two-way RAID1.
lvconvert --type linear vg/lvol1Convert a mirror back to linearWorks on mirror and raid1 volumes alike.
lvconvert --type RaidLevel LVChange the RAID levelCalled takeover, e.g. raid5 to raid6, done to change resilience or to restripe.
lvconvert --stripes Number LVChange the stripe countReshapes a RAID LV to a different number of stripe images at the same RAID level.
lvconvert --splitmirrors 1 --name lv_split vg/lvol1Split off a mirror imageDetaches one image of a mirror or raid1 LV as a new LV called lv_split.
lvconvert --splitmirrors 1 --trackchanges vg/lvol1Split an image and track changesThe raid1 LV records what changes while the image is detached, ready for a later merge.
lvconvert --mergemirrors vg/lvol1_rimage_1Merge a tracked image backReturns an image split with --trackchanges to its raid1 LV.
lvcreate --type cache-pool -L 1G -n my_cpool vg00 /dev/fast1Create a cache poolBuilt on a fast device; attach it to an LV afterwards to cache that LV.
lvcreate --type cache --cachepool my_cpool -L 100G -n mylv vg00 /dev/slow1Create a cached LV in one stepMakes a new origin on the slow device and joins it to a cache pool that already exists.
lvconvert --type cache --cachepool fast vg/mainAttach a cache pool (dm-cache)Starts the dm-cache hot-spot cache on the main LV, with the fast LV as its cache pool.
lvconvert --type cache --cachevol fast vg/mainAttach a cachevol (dm-cache)With a cachevol, cache data and metadata are kept together on the one fast LV.
lvconvert --type writecache --cachevol fast vg/mainAttach a write cachedm-writecache speeds up writes only: data read from the main LV is not kept in the cache.
lvs -ao+devicesShow cache LVs and their devicesWhile attached, the fast LV is hidden and carries a _cvol or _cpool suffix.
lvs -o+cache_mode VG/LVShow the cache modeThe mode is set with --cachemode when caching starts, or changed later on a cached LV.
lvconvert --splitcache vg/mainDetach the cache and keep itSeparates the fast LV; the main LV returns to the type it had before caching.
lvconvert --uncache vg/mainDetach and delete the cacheStops caching and also removes the cache pool that is no longer needed.

Moving and removing 17

Repeating the force option as -ff makes pvremove wipe a PV that still belongs to a VG; the manual says vgreduce should normally be used instead.

CommandWhat it does
pvmove /dev/sdb1Empty a physical volumeMoves every extent that simple LVs use on this PV to free space elsewhere in the VG.
pvmove /dev/sdb1 /dev/sdc1Move extents to a chosen PVWithout a destination, the normal allocation rules of the VG decide where data goes.
pvmove -n lvol1 /dev/sdb1 /dev/sdc1Move one LV's extentsOnly the extents that belong to lvol1 leave the source PV.
pvmove /dev/sdb1:1000-1999Move a range of extentsExtent numbers 1000 to 1999 inclusive rather than the whole device.
pvmove /dev/sdb1:1000+1000Move a range by start and lengthCounting starts at 0, so this covers the 1001st to the 2000th extent.
pvmove /dev/sdb1:1000-1999 /dev/sdc1:0-999Move a range to chosen extentsSource range and destination range are both named, on two PVs.
pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999Move extents within one diskSource and destination on the same PV require the anywhere allocation policy.
pvmoveResume interrupted movesRun with no PV after a crash: unfinished moves restart from their latest checkpoint.
pvmove -bMove in the backgroundReturns before the move has finished and leaves the polling to a background process.
pvmove --abortAbort running movesMoved segments stay on the destination unless the move was started with --atomic.
vgreduce VG PVRemove an unused PVOnly unused PVs can go, so empty the device with pvmove first.
vgreduce -a VGRemove all empty PVs
vgreduce --removemissing VGDrop PVs that are missingWorks when no LVs are allocated on the lost PVs; with --force it also removes partial LVs.
pvremove PVWipe the LVM label from a deviceLVM then no longer sees the device as a PV; it cannot be done while an active LV uses it.
lvremove -f vg00/lvol1Remove an LV without promptingA single -f skips the confirmation asked for an active LV.
lvremove vg00Remove every LV in a VGRemoving an origin LV also removes all snapshots that depend on it.
vgremove VGRemove a volume groupPrompts for confirmation if the VG still contains LVs.

Activation and metadata backup 14

vgcfgbackup saves VG metadata only: it does not back up the data in LVs, and it does not back up thin pool metadata.

CommandWhat it does
vgchange -a yActivate all LVsWith no VG named it covers every LV in every VG on the devices present.
vgchange -a n VGDeactivate a VG's LVsMakes the LVs unavailable and removes their block devices; required before vgexport.
vgchange --refreshReload LVs with latest metadata
lvchange -ay vg/volActivate one LVAn active LV is reachable through its block device and the /dev/VGName/LVName link.
lvchange -an vg/volDeactivate one LVThe block device and its symbolic link are removed from the system.
pvscan --cache -a ayAutoactivate a complete VGNotes the PV as online and activates its VG once all of its PVs are present.
vgscan --mknodesScan and repair device nodesAlso checks the special files in /dev for active LVs, adding missing ones and deleting unused ones.
vgmknodesRecreate LV device filesRarely needed on a system whose components work together correctly.
vgcfgbackupBack up VG metadataWith no VG named, writes one file per VG under /etc/lvm/backup; LV contents are not included.
vgcfgbackup -f FILE VGBack up metadata to a named fileFor several VGs the name acts as a template in which %s becomes the VG name.
vgcfgrestore VGRestore VG metadataUses the most recent backup file when none is named.
vgcfgrestore -f FILE VGRestore from a chosen backup fileWrites the VG metadata onto the devices named in that backup file.
vgcfgrestore -l VGList metadata backups of a VGShows the backup and archive files available for that VG.
pvcreate --restorefile FILENAME --uuid UUIDRecreate a lost PV with its UUIDInitialises a same-size replacement under the missing PV's UUID, before vgcfgrestore brings the VG metadata back.

Configuration and diagnostics 23

CommandWhat it does
lvm versionShow version information
lvm helpShow the help text
lvmStart the LVM shellWith no arguments lvm opens a readline prompt with history and command completion.
lastlogShow the last command's logTyped at the lvm> prompt of the shell; command log reporting has to be switched on.
lvm segtypesList segment typesNames the LV segment types this build recognises.
lvm formatsList metadata formats
lvm devtypesList block device typesShows the built-in device types that LVM recognises.
lvm tagsList host tagsPrints the tags that are defined on this host.
lvm systemidShow the host's system IDTells you whether a system ID is configured on the local machine.
lvmconfigPrint the LVM configurationFormatted output of the configuration tree, built from lvm.conf and any --config settings.
lvmconfig --type default --withcommentsPrint defaults with commentsThe comments describe each setting, including the individual cache settings.
lvmconfig --type default activation/activation_modePrint one default settingName a section/setting path to limit the output to that value.
lvmdevicesList the devices filePrints the entries of /etc/lvm/devices/system.devices, the list of devices LVM commands will use.
lvmdevices --adddev DEVICEAdd a device to the devices fileThe device is named by its path; --addpvid takes a PVID instead.
lvmdevices --deldev DEVICERemove a device from the fileLVM no longer sees or uses a device once its entry is gone.
lvmdevices --checkCheck the devices fileReports whether its content needs updating, without changing anything.
lvmdevices --updateUpdate the devices fileRewrites fields that are out of date, such as the last known device name.
vgimportdevices -aAdd the PVs of all visible VGsFills the devices file from every volume group that can be seen.
vgimportdevices VGAdd the PVs of one VG
lvmdumpCollect a diagnostic tarballGathers dmsetup info, the process table, recent system log entries, /etc/lvm and device listings.
lvmdump -mInclude on-disk metadataAdds a 1:1 copy of the metadata area of every visible PV, which can enlarge the dump a lot.
lvmdump -aCollect the advanced setAdds debug output of vgscan and pvscan and lists of all VGs, PVs and LVs; may hang if lvm is hung.
lvmdump -d DIRECTORYDump into a directoryLeaves the raw dump tree in that directory rather than one compressed tarball.

Notes

From disk to filesystem

pvcreate /dev/sdc4 /dev/sde initialises a partition and a whole disk for LVM, vgcreate myvg /dev/sdk1 /dev/sdl1 makes a volume group from two PVs, and lvcreate -L Size VG carves a logical volume out of the group's free extents — -L for a fixed size, lvcreate -l 100%FREE -n mylv vg00 for the rest. Format and mount the resulting /dev/vgname/lvname like any block device. pvs, vgs and lvs are the one-line reports for each layer; pvdisplay, vgdisplay and lvdisplay are the verbose forms, and the manual calls the short reports the preferred alternative.

Growing safely, shrinking carefully

Growing is safe: vgextend vg00 /dev/sda4 /dev/sdn1 adds new PVs to the group, lvextend -l+100%FREE -r vg01/lvol01 grows the LV (with -r to resize the filesystem in the same step), and pvresize /dev/sda1 picks up a partition that was enlarged underneath. Shrinking is the operation that destroys data when done in the wrong order: data in the reduced area is lost, so the filesystem must be resized before lvreduce -l -3 vg00/lvol1 runs. lvreduce -r -L Size LV and lvresize -r -L Size LV have fsadm resize the filesystem together with the LV. vgreduce VG PV removes only unused PVs from a group, so pvmove /dev/sdb1 has to migrate the extents elsewhere first.

Snapshots, recovery and cleanup

lvcreate --snapshot --size 100m --name mysnap vg00/mylv makes a copy-on-write snapshot of an LV — a frozen image for backups or before a risky upgrade — and lvconvert --mergesnapshot LV merges it back into its origin. vgcfgbackup and vgcfgrestore VG save and restore the VG metadata, not the data inside the LVs; by default each VG is backed up to a file under /etc/lvm/backup. When a PV is lost, pvcreate --restorefile FILENAME --uuid UUID recreates it with the old UUID before the metadata is restored. vgexport VG and vgimport VG move a group between hosts cleanly, and vgrename vg02 myvg and lvrename vg02 lvold lvnew fix names without touching data. lvremove vg00, vgremove VG and pvremove PV tear the layers down in that order. lvmdiskscan is deprecated; the manual says to use pvs instead.

Questions

How do I grow a logical volume and its filesystem in one command?

Add -r to lvextend: lvextend -l+100%FREE -r vg01/lvol01 takes all free space in the VG and has fsadm resize the filesystem together with the LV. lvresize -r -L Size LV does the same with an explicit size.

How do I shrink a logical volume safely?

Use lvresize -r -L Size LV or lvreduce -r -L Size LV; the -r option resizes the filesystem together with the LV through fsadm. Without -r, shrink the filesystem yourself first: lvreduce discards the data in the extents it removes.

How do I remove a disk from a volume group?

pvmove /dev/sdb1 migrates its extents to other PVs, then vgreduce VG PV takes the emptied PV out of the group and pvremove PV wipes its LVM label.

What is the difference between pvs and pvdisplay?

pvs prints one line per PV in configurable columns; pvdisplay prints a detailed block per PV. The manual calls pvs the preferred alternative, and the same pairing exists for vgs and vgdisplay, lvs and lvdisplay.

Sources and checks

43 more source pages

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

22 rows from the earlier version of this page were removed in that check: duplicates, and bindings the documentation does not list or lists differently.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.