Linux Logical Volume Management Operations: Difference between revisions
Jump to navigation
Jump to search
Line 100: | Line 100: | ||
* <span id='Extending_a_Logical_Volume'></span>[[lvresize]] - resize a logical volume. | * <span id='Extending_a_Logical_Volume'></span>[[lvresize]] - resize a logical volume. | ||
* <span id='Renaming_a_Logical_Volume'>[[lvrename]] | * <span id='Renaming_a_Logical_Volume'>[[lvrename]] | ||
* [[lvchange]] | |||
* <span id='Remove_a_Logical_Volume'><span id='Removing_a_Logical_Volume'>[[lvremove]] - removes a logical volume from a volume group. | * <span id='Remove_a_Logical_Volume'><span id='Removing_a_Logical_Volume'>[[lvremove]] - removes a logical volume from a volume group. | ||
Revision as of 18:23, 23 May 2017
External
- https://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/
Internal
Overview
Logical volume management commands can be issued from the lvm console, or as standalone commands. For example:
lvm> lvs
produces identical results to
lvs
Inventory of Devices that May Be Used as Physical Volumes
lvmdiskscan
Example:
[root@rhel-test ~]# lvmdiskscan /dev/rhel_rhel-test/swap [ 820.00 MiB] /dev/sda1 [ 500.00 MiB] /dev/rhel_rhel-test/root [ 6.67 GiB] /dev/sda2 [ 7.51 GiB] LVM physical volume /dev/sdb [ 2.00 GiB] 3 disks 1 partition 0 LVM physical volume whole disks 1 LVM physical volume
The output specifies which device is already a LVM Physical Volume
To see only the existing Physical Volumes (devices that have Volume Groups on them)
lvmdiskscan -l
Physical Volume Operations
Information about Physical Volumes
- pvs - provides information about physical volumes available on the system.
- pvscan - scans all disks for physical volumes.
- pvdisplay - provides details about a specific physical volume.
Physical Volume Management Operations
- pvcreate - initializes a physical volume(s) for use by LVM.
- pvchange - changes attributes of a physical volume.
- pvresize - resizes a disk or partition in use.
- pvmove - moves physical extents from one physical volume to another.
- pvck - checks the consistency of the physical volume metadata.
- pvremove - removes a physical volume.
Volume Group Operations
Information about Volume Groups
Volume Group Management Operations
- vgcreate - create a volume group.
- vgextend - add Physical Volumes to a Volume Group.
- vgreduce - removes one or more unused physical volumes from a volume group.
- vgremove - deletes a volume group.
Logical Volume Operations
Information about Logical Volumes
- lvs - provides information about logical volumes available on the system.
- lvdisplay - displays attributes of a logical volume.
- lvscan - scans all known volume groups or all supported LVM block devices in the system for defined Logical Volumes.
Logical Volume Management Operations
- lvcreate - creates a logical volume in an existing volume group.
- lvresize - resize a logical volume.
- lvrename
- lvchange
- lvremove - removes a logical volume from a volume group.
Procedures
- https://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/
Shrinking the Filesystem and the Logical Volume
This is the simple case, it will only work if the logical volume *does not* contain a partition table:
fsadm
or
umount lvm_partition resize2fs /dev/vg/lv newSize lvresize -L disksize /dev/vg/lv resize2fs /dev/vg/lv