Flag | Usage |
---|---|
--devices PV |
|
--setphysicalvolumesize newSize |
|
-t --test | run in test mode |
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
Physical volume "/dev/sdb" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
Physical volume "/dev/sdb" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
--- Physical volume ---
PV Name /dev/sdb
VG Name VolGroup
PV Size <100,00 GiB / not usable 3,00 MiB
Allocatable yes
PE Size 4,00 MiB
Total PE 25599
Free PE 12800
Allocated PE 12799
PV UUID 0q1N12-UMre-cfj8-ZtPO-iuFb-6TwI-mTfqBW
PV VG Fmt Attr PSize PFree /dev/sda2 rhel lvm2 a-- 19,00g 0 /dev/sdb1 rhel lvm2 a-- 20,00g 0 /dev/sdc1 lvm2 --- 50,00g 50,00g /dev/sdd1 lvm2 --- 50,00g 50,00g /dev/sde1 lvm2 --- 1023,00m 1023,00m /dev/sdf1 lvm2 --- 1023,00m 1023,00m
Field | Meaning |
---|---|
PV | physical volume name |
VG | volume group name |
Fmt | The metadata format of the physical volume (lvm2 or lvm1) |
Attr | Attributes of the physical volume (source) : |
PSize | Size of the physical volume |
PFree | Free space on the physical volume |
Flag | Usage |
---|---|
--all | Include information in the output about devices that have not been initialized with pvcreate |
--segments | Produces one line of output for each contiguous allocation of space on each physical volume, showing the start (pvseg_start) and length (pvseg_size) in units of physical extents. |
lvcreate [options] -n newLogicalVolume existingVolumeGroup
Flag | Usage | ||||||
---|---|---|---|---|---|---|---|
-I stripeSizeKb --stripesize stripeSizeKb | stripeSizeKb must be a power of 2, while not exceeding the physical extent size (more) | ||||||
-i stripes --stripe stripes | stripes is the number of physical volumes the striped logical volume will span onto | ||||||
-L size --size size | Size to allocate for the new logical volume. size is formatted like numberUnit
|
||||||
-l sizeInNbOfExtents --extents sizeInNbOfExtents |
Size to allocate for the new logical volume in number of extents
|
||||||
-m nbCopies --mirrors nbCopies | Create a mirrored logical volume with nbCopies copies : -m 1 would result in a mirror with two-sides; that is, a linear volume plus one copy | ||||||
-n newLogicalVolumeName --name newLogicalVolumeName |
Name of the new logical volume | ||||||
-s --snapshot | Create a snapshot logical volume (or snapshot) for an existing, so called original logical volume (or origin). Snapshots provide a "frozen image" of the contents of the origin while the origin can still be updated. They enable consistent backups and online recovery of removed/overwritten data/files. The snapshot does not need the same amount of storage the origin has. In a typical scenario, 15-20% might be enough. In case the snapshot runs out of storage, use lvextend to grow it. Shrinking a snapshot is supported by lvreduce as well. |
Flag | Usage |
---|---|
-l --extents | Extend or set the logical volume size in units of logical extents. |
-L --size | Extend or set the logical volume size in units of megabytes. A size suffix of M for megabytes, G for gigabytes, T for terabytes, ..., is optional. With the + sign the value is added to the actual size of the logical volume and without it, the value is taken as an absolute one :
|
-r --resizefs |
|
-t --test | Run in test mode : commands will not update metadata.
This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't.
|
lvextend /dev/vg01/lv01 /dev/sdk3
This means adding the full capacity of /dev/sdk3 to the logical volume.
This is equivalent to specifying -l +100%PVS on the command line.
Flag | Usage |
---|---|
-L sizeInMB --size sizeInMB |
Reduce or set the logical volume size in number of MB. You can add a size suffix: k, m, g or t.
lvreduce --size targetSize logicalVolume
lvreduce --size -removedSize logicalVolume
|
-l numberOfExtents --extents numberOfExtents |
Reduce or set the logical volume size in number of logical extents.
lvreduce --extents targetSize logicalVolume
lvreduce --extents -removedSize logicalVolume
numberOfExtents can also be expressed with a suffix :
|
-r --resizefs | resize underlying filesystem together with the logical volume |
Flag | Usage |
---|---|
(none) --all | List all volume groups. |
--noheadings | Suppress the headings line that is normally the first line of output. Useful if grepping the output. |
--units hHbBsSkKmMgGtTpPeE | Output sizes in these units: human-readable, bytes, sectors, kilobytes, megabytes, gigabytes, terabytes, petabytes, exabytes. Lowercase units are powers of 1024. Uppercase units are powers of 1000. |
pvcreate [options] physicalVolume
physicalVolume can be :For whole disk devices, the partition table must be erased, which will effectively destroy all data on that disk. This can be done by zeroing the first sector with :
vgdisplay [options] volumeGroupName
Flag | Usage |
---|---|
-s --short | short display |
-v --verbose | Display verbose information containing long listings of physical and logical volumes. If given twice, also display verbose runtime information of vgdisplay's activities. |
Flag | Usage |
---|---|
-m --maps | Display the mapping of physical extents to logical volumes and logical extents. |
-s --short | Only display the size of the given physical volumes. |
Flag | Usage |
---|---|
-m --maps | Display the mapping of logical extents to physical volumes and physical extents. To map physical extents to logical extents use: pvs --segments -o+lv_name,seg_start_pe,segtype |
-v --verbose | (explicit) |
Scan for all devices visible to LVM2.
lvmdiskscan is /sbin/lvmdiskscan, so root or sudo only.
/dev/caramba-vg/root [ 20.00 GiB] /dev/sda1 [ 243.00 MiB] /dev/caramba-vg/var [ 12.00 GiB] /dev/caramba-vg/swap_1 [ 3.80 GiB] /dev/sda3 [ 40.00 GiB] LVM physical volume /dev/caramba-vg/tmp [ 380.00 MiB] /dev/caramba-vg/home [ 24.41 GiB] /dev/sda5 [ 39.76 GiB] LVM physical volume 4 disks 2 partitions 0 LVM physical volume whole disks 2 LVM physical volumes
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 80G 0 disk ├─sda1 8:1 0 243M 0 part /boot ├─sda2 8:2 0 1K 0 part ├─sda3 8:3 0 40G 0 part │ ├─caramba--vg-root 254:0 0 20G 0 lvm / │ └─caramba--vg-var 254:1 0 12G 0 lvm /var └─sda5 8:5 0 39.8G 0 part ├─caramba--vg-root 254:0 0 20G 0 lvm / ├─caramba--vg-var 254:1 0 12G 0 lvm /var ├─caramba--vg-swap_1 254:2 0 3.8G 0 lvm [SWAP] ├─caramba--vg-tmp 254:3 0 380M 0 lvm /tmp └─caramba--vg-home 254:4 0 24.4G 0 lvm /home sr0 11:0 1 1024M 0 rom
Flag | Usage |
---|---|
--noheadings | Suppress the headings line that is normally the first line of output. Useful if grep-ping the output. |
-o options --options options |
output format : comma-separated ordered list of columns. To list available fields : lvs -o help example : lvs -o +layout,devices |
--segments | show segment information |
vgcreate volumeGroupName physicalVolume [physicalVolume2]
vgremove volumeGroupToRemove
Flag | Usage |
---|---|
-f --force | Do not prompt for confirmation before removing a logical volume |
vgreduce volumeGroupName physicalVolume
vgextend volumeGroupName physicalVolume
Flag | Usage |
---|---|
-t --test | run in test mode |