This document is free text: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see
LVM, or Logical Volume Manager allows for more flexible and dynamic management of disk space compared to traditional partitioning schemes.
It enables features such as resizing volumes, creating snapshots, and managing multiple physical storage devices more effectively.
To get the best of LVM, it must be defined when the OS is installed. That way we can use LVM for (nearly) all of our disk space (boot partition can not be in LVM).
It is possible to install the OS without LVM and add it later too. But to use LVM on the / (root) partition, we need to install it when we install the OS.
Tested on the following environments:
Red Hat Documentation
ChatGPT
Storage devices or partitions that LVM uses as a building block.
Could be a complete hard drive, a disk partition, or even a RAID array.
Collections of one or more physical volumes.
Act as a pool that aggregates the storage space from multiple physical volumes.
Logical volumes are created within volume groups.
An abstraction that represents a portion of a volume group.
Similar to partitions in traditional disk management.
Can be resized and moved without affecting the data stored on them.
There are 6 main LV types.
Default logical volume type.
Data is stored sequentially.
lvcreate -n mylv -L 10G myvg
Provides data redundancy with multiple copies (mirrors) of the data.
Offers fault tolerance; if one mirror fails, the remaining mirrors can be used.
lvcreate --type mirror --mirrors 2 -n mymirroredlv -L 10G myvg
Creates a point-in-time copy (snapshot) of an existing logical volume.
Useful for backup purposes or creating consistent images of a volume for testing.
lvcreate --type snapshot -n mysnapshotlv -L 5G --snapshot /dev/myvg/mylv
Enables efficient storage allocation by using thin provisioning.
Allocates space only as needed, allowing for more flexible use of storage resources.
lvcreate --type thin-pool -n mythinpool -L 100G myvg
lvcreate --type thin -n mythinvolume -V 50G --thinpool myvg/mythinpool
Used to cache data for another logical volume, providing improved performance.
Typically used with SSDs to cache data from slower spinning disks.
lvcreate --type writeback --size 100M --name mycachelv myvg
lvconvert --type writecache --cachevol myvg/mycachelv \
--name mycachedlv myvg/myoriginalvolume
Stripes data evenly across multiple physical volumes to enhance I/O performance.
Allows parallel read and write operations.
lvcreate --type striped -i 2 -I 4M -L 200G -n striped_lv myvg
Provides physical volume information in a configurable form, displaying one line per physical volume
sudo pvs
sudo pvs /dev/sdb
Scans all supported LVM block devices in the system for physical volumes.
sudo pvscan
Locates and identifies the physical volumes on the system and updates the metadata cache used by LVM.
Provides a verbose multi-line output for each physical volume.
sudo pvdisplay
sudo pvdisplay /dev/sdb
Display a mapping of the physical extents to the corresponding logical volumes.
sudo pvdisplay -m /dev/sdb
Initializes a physical volume for use by LVM.
sudo pvcreate /dev/sdb
sudo pvcreate /dev/sdb1
Make sure the device or partition is not used. It will be erased.
After initializing, you can create or extend volume groups using the vgcreate or vgextend commands, respectively.
Removes LVM metadata from a physical volume.
sudo pvremove /dev/sdb
sudo pvremove /dev/sdb1
Make sure you are not removing a used PV.
Remove any logical volumes and volume groups associated with the physical volume before running pvremove
.
After pvremove, you can repurpose the device or partition for other uses, like creating a new partition, filesystem, etc.
Move allocated physical extents from one physical volume to another within the same volume group.
Move all the data in /dev/sda1 to /dev/sdb1. They must be in the same VG
sudo pvmove /dev/sda1 /dev/sdb1
Resize a physical volume
sudo pvresize /dev/sdb1
Must be used when the underlying block device is resized.
Changes the properties (allocatable, uuid, tags etc) of a physical volume.
Make the physical volume /dev/sdb1 allocatable
sudo pvchange -x y /dev/sdb1
Deactivate (disable) the physical volume in verbose mode.
sudo pvchange -x y /dev/sdb1
Checks and repairs LVM metadata on PVs
Check a PV
sudo pvck /dev/sdb1
Provides volume group information in a configurable form, displaying one line per volume group
sudo vgs
sudo vgs myvg
Scans all supported LVM block devices in the system for volume groups.
sudo vgscan
Updates the metadata cache used by LVM. This cache maintains information about the volume groups on the system.
Displays volume group properties such as size, extents, number of physical volumes, and other options in a fixed form.
sudo vgdisplay
sudo vgdisplay myvg
Creates a new volume group.
Create a new volume group named myvg using the physical volume /dev/sdb1
sudo vgcreate myvg /dev/sdb1
Before vgcreate, physical volumes must be initialized with pvcreate.
Volume group names are case-sensitive.
When creating a volume group, LVM considers the total size of the physical volumes.
After creating a volume group with vgcreate, you can proceed to create logical volumes.
Adds physical volumes to an existing volume group.
Add physical volume /dev/sdb2 to the volume group myvg
sudo vgextend myvg /dev/sdb2
Before using vgextend, ensure that the physical volumes you specify are initialized with pvcreate.
After extending a volume group with vgextend, you can use the additional storage space to either extend existing logical volumes or create new ones within the extended volume group.
Remove one or more physical volumes from a volume group.
Remove /dev/sdb2 from volume group myvg
sudo vgreduce myvg /dev/sdb1
When removing a physical volume, the data on that physical volume is moved to other available physical volumes in the volume group.
Removing a physical volume from a volume group is a significant operation and can impact data availability. Ensure that you have proper backups before performing such operations.
Removes a volume group.
sudo vgremove myvg
Before using vgremove
, ensure that there are no logical volumes or other dependencies associated with the volume group.
Remove any logical volumes within the volume group using lvremove before using vgremove.
Ensure that any filesystems mounted from logical volumes within the volume group are unmounted before attempting to remove the volume group.
After removing a volume group with vgremove, the physical volumes that were part of the volume group become unallocated, and you can repurpose them for other uses.
Change the attributes of a volume group.
Activate (enable) the volume group myvg.
sudo vgchange -a y myvg
Renames a volume group.
sudo vgrename oldvg newvg
Checks the consistency of volume groups
sudo vgck
Rewrite VG metadata to correct problems.
sudo vgck --updatemetadata myvg -v
Provides logical volume information in a configurable form, displaying one line per logical volume
sudo lvs
sudo lvs /dev/vg_name/lv_name
sudo lvs /dev/myvg/mylv
All LVs in a VG
sudo lvs /dev/vg_name
sudo lvs /dev/myvg
Scans for all logical volumes in the system and lists them.
sudo lvscan
Displays logical volume properties, such as size, layout, and mapping in a fixed format
sudo lvdisplay
sudo lvdisplay myvg/mylv
Specify units in megabytes
sudo lvdisplay --unit m myvg/mylv
Creates a new logical volume within a volume group.
Create a new LV named mylv in myvg VG with size 11 GB
sudo lvcreate -L 11G -n mylv myvg
Format created logical volume:
sudo mkfs -t ext4 /dev/myvg/mylv
Mount it
sudo mkdir /mnt/point
sudo mount /dev/myvg/mylv /mnt/point
Unmount it
sudo umount /mnt/point
Extends the size of a logical volume.
Extend mylv logical volume by 2 GB
sudo lvextend -L +2G myvg/mylv
Resize the file system
sudo resize2fs /dev/myvg/mylv
xfs_growfs
is used for XFS.
Reduces the size of a logical volume.
Reduce the logical volume mylv in the volume group myvg by 2 GB.
sudo lvreduce -L -1G myvg/mylv
Resize the file system (you may need to unmount the LV)
sudo resize2fs /dev/myvg/mylv
Removes a logical volume.
Remove the logical volume mylv in the volume group myvg.
sudo lvremove myvg/mylv
The command permanently deletes the data.
Ensure that any filesystems mounted from the logical volume are unmounted before attempting to remove it.
Changes the attributes and status of a logical volume. Activate or deactivate a logical volume, modify its permission flags, or change its allocation policy.
Deactivate (or sets to "no") the activation of the logical volume mylv in the volume group myvg.
sudo lvchange -a n myvg/mylv
Activate it
sudo lvchange -a y myvg/mylv
Sets the read-only permission in a logical volume
sudo lvchange -p r myvg/mylv
Sets back the read/write permission in a logical volume
sudo lvchange -p rw myvg/mylv
Renames a logical volume name
sudo lvrename myvg mylv mynewlv2
We have a system installed without LVM.
The steps:
sudo apt update
sudo apt -y install lvm2
Output of lsblk -i
command before adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
For physical servers, you need to add a disk to the hardware. For virtual servers you have to define it and attach it to the VM.
I'm adding a 20 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 20G 0 disk
That means, my new disk is /dev/sdb.
At the following steps, you need to change /dev/sdb to your disk device name.
Mark /dev/sdb as a PV
sudo pvcreate /dev/sdb
Create a VG named "myvg" using /dev/sdb
sudo vgcreate myvg /dev/sdb
Create the LV using the maximum available size with name mylv
sudo lvcreate -l +100%FREE -n mylv myvg
Format as Ext4
sudo mkfs -t ext4 /dev/myvg/mylv
Create a mount point
sudo mkdir /mnt/mylv
Mount mylv to the mount point /mnt/mylv
sudo mount /dev/myvg/mylv /mnt/mylv
If you want the mount to be persistent, add to the end of /etc/fstab
sudo nano /etc/fstab
Add to the end of the file
/dev/myvg/mylv /mnt/mylv ext4 defaults 0 0
Check with lsblk
lsblk -i
Output of the command
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 20G 0 disk
`-myvg-mylv 254:0 0 20G 0 lvm /mnt/mylv
Check with df -h
df -h
Output of the command
Filesystem Size Used Avail Use% Mounted on
udev 457M 0 457M 0% /dev
tmpfs 97M 544K 96M 1% /run
/dev/sda1 22G 1.8G 19G 9% /
tmpfs 481M 0 481M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/mapper/myvg-mylv 20G 44K 19G 1% /mnt/mylv
tmpfs 97M 0 97M 0% /run/user/1000
Create some big files in the filesystem
Create a directory for files
sudo mkdir /mnt/mylv/tmp
Make it writable for everyone
sudo chmod 777 /mnt/mylv/tmp
Create 3 files of 500 MB each
< /dev/urandom tr -dc "[:space:][:print:]" | head -c500M > /mnt/mylv/tmp/file1
< /dev/urandom tr -dc "[:space:][:print:]" | head -c500M > /mnt/mylv/tmp/file2
< /dev/urandom tr -dc "[:space:][:print:]" | head -c500M > /mnt/mylv/tmp/file3
Check contents
ls -al /mnt/mylv/tmp
I'm adding a 30 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 20G 0 disk
`-myvg-mylv 254:0 0 20G 0 lvm /mnt/mylv
sdc 8:32 0 30G 0 disk
That means, my new disk is /dev/sdc.
At the following steps, you need to change /dev/sdc to your disk device name.
Mark /dev/sdc as a PV
sudo pvcreate /dev/sdc
Add /dev/sdc to VG myvg
sudo vgextend myvg /dev/sdc
Extend mylv LV to maximum
sudo lvextend -l +100%FREE myvg/mylv
sudo resize2fs /dev/myvg/mylv
Check "df -h" command to check the new size
df -h
Output of the command
Filesystem Size Used Avail Use% Mounted on
udev 457M 0 457M 0% /dev
tmpfs 97M 548K 96M 1% /run
/dev/sda1 22G 3.2G 18G 16% /
tmpfs 481M 0 481M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/mapper/myvg-mylv 50G 1.5G 46G 4% /mnt/mylv
Add another big file
< /dev/urandom tr -dc "[:space:][:print:]" | head -c500M > /mnt/mylv/tmp/file4
Check contents
ls -al /mnt/mylv/tmp
I'm adding a 50 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 20G 0 disk
`-myvg-mylv 254:0 0 30G 0 lvm /mnt/mylv
sdc 8:32 0 30G 0 disk
`-myvg-mylv 254:0 0 30G 0 lvm /mnt/mylv
sdd 8:48 0 50G 0 disk
That means, my new disk is /dev/sdd.
At the following steps, you need to change /dev/sdd to your disk device name.
Mark /dev/sdd as a PV
sudo pvcreate /dev/sdd
Add /dev/sdd to VG myvg
sudo vgextend myvg /dev/sdd
Move from 20 GB disk to 50 GB disk
sudo pvmove /dev/sdb /dev/sdd
Move from 30 GB disk to 50 GB disk
sudo pvmove /dev/sdc /dev/sdd
These may take some time
First remove them from the VG
sudo vgreduce myvg /dev/sdb
sudo vgreduce myvg /dev/sdc
Now remove PVs (unmark them as PV)
sudo pvremove /dev/sdb
sudo pvremove /dev/sdc
At this step we physically remove (or unattach 20 GB and 30 GB disks)
Output of lsblk -i
command after removing the disks
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 50G 0 disk
`-myvg-mylv 254:0 0 30G 0 lvm /mnt/mylv
As you can see, /dev/sdd became /dev/sdb but there is no problem. Our LVM is still working.
Check contents
ls -al /mnt/mylv/tmp
When we take a snapshot, we create a place to save the original states of the files that are changed after the snapshot.
That way, those original states can be used to revert to the snapshot.
Because only the originals of the changed data is backed up, snapshots do not require a lot of place.
If a snapshot is full, the snapshot becomes invalid because it can no longer track changes on the original volume.
Snapshots are resizable.
We have a system installed with LVM.
The steps:
Output of lsblk -i
command before adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 20G 0 disk
|-sda1 8:1 0 487M 0 part /boot
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 19.5G 0 part
|-myvg-root 254:0 0 18.6G 0 lvm /
`-myvg-swap_1 254:1 0 980M 0 lvm [SWAP]
Note:
When installing LVM at the install time, Debian lets you choose the VG name, as I choose it as myvg. Debian chooses the LV name as root.
Ubuntu doesn't let us choosing VG and LV names, they are given as ubuntu-vg and root.
At this section, you need to change myvg to your Volume Group name (ubuntu-vg for Ubuntu) for all the commands.
Output of "pvs" before adding the disk
PV VG Fmt Attr PSize PFree
/dev/sda5 myvg lvm2 a-- <19.52g 0
Output of "lvscan" before adding the disk
ACTIVE '/dev/myvg/root' [18.56 GiB] inherit
ACTIVE '/dev/myvg/swap_1' [980.00 MiB] inherit
Output of "df -h" before adding the disk
Filesystem Size Used Avail Use% Mounted on
udev 458M 0 458M 0% /dev
tmpfs 97M 544K 96M 1% /run
/dev/mapper/myvg-root 19G 1.6G 16G 10% /
tmpfs 481M 0 481M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda1 455M 98M 333M 23% /boot
tmpfs 97M 0 97M 0% /run/user/1000
For physical servers, you need to add a disk to the hardware. For virtual servers you have to define it and attach it to the VM.
I'm adding a 20 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 20G 0 disk
|-sda1 8:1 0 487M 0 part /boot
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 19.5G 0 part
|-myvg-root 254:0 0 18.6G 0 lvm /
`-myvg-swap_1 254:1 0 980M 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
That means, my new disk is /dev/sdb.
At the following steps, you need to change /dev/sdb to your disk device name.
Mark /dev/sdb as a PV
sudo pvcreate /dev/sdb
Add /dev/sdb to VG myvg
sudo vgextend myvg /dev/sdb
Extend the root LV (LV defined at the system install) to maximum
sudo lvextend -l +100%FREE myvg/root
sudo resize2fs /dev/myvg/root
Output of df -h
after expanding the disk
Filesystem Size Used Avail Use% Mounted on
udev 458M 0 458M 0% /dev
tmpfs 97M 548K 96M 1% /run
/dev/mapper/myvg-root 38G 1.6G 35G 5% /
tmpfs 481M 0 481M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda1 455M 98M 333M 23% /boot
tmpfs 97M 0 97M 0% /run/user/1000
I'm adding a 30 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
sda 8:0 0 20G 0 disk
|-sda1 8:1 0 487M 0 part /boot
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 19.5G 0 part
|-myvg-root 254:0 0 38.6G 0 lvm /
`-myvg-swap_1 254:1 0 980M 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
`-myvg-root 254:0 0 38.6G 0 lvm /
sdc 8:32 0 30G 0 disk
That means, my new disk is /dev/sdc.
At the following steps, you need to change /dev/sdc to your disk device name.
Mark /dev/sdc as a PV
sudo pvcreate /dev/sdc
sudo vgextend myvg /dev/sdc
Snapshots must be in the same VG as the original LV
Create a snapshot named mysnapshot of LV root from VG myvg. Size is 2 GB.
sudo lvcreate --type snapshot -n mysnapshot -L 2G --snapshot /dev/myvg/root
Well, the idea is to change the data on the myvg/root LV. I'll try installing some software.
sudo apt update
sudo apt install apache2 mariadb-server
Let's check our Snapshot
sudo lvs -o lv_name,lv_size,origin
Create a temporary mount point
sudo mkdir /mnt/mysnapshot
Mount the snapshot to the mount point
sudo mount /dev/myvg/mysnapshot /mnt/mysnapshot
In /mnt/mysnapshot, you'll see the changed folders and files
Unmount it
sudo umount /mnt/mysnapshot
We may extend the snapshot to allow more changes on the origin LV
sudo lvextend -L+1G /dev/myvg/mysnapshot
When we are done, we can revert to the snapshot.
Normally, reverting to a snapshot requires the original volume to be unmounted. But since we cannot unmount the root volume, we are going to need to reboot the system.
sudo lvconvert --merge myvg/mysnapshot
sudo reboot
Our snapshot LV is gone after the merge.
It is possible to export and import Volume Groups with their Logical Volumes.
LVs are unmounted, VG is deactivated and exported, physical disks are moved, VG is imported and activated, and finally LVs are mounted.
We have 2 systems installed without LVM, srva and srvb. We will install a LV on srva, fill it with data, and we will move the LV to srvb.
sudo apt update
sudo apt -y install lvm2
Output of lsblk -i
command before adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
For physical servers, you need to add a disk to the hardware. For virtual servers you have to define it and attach it to the VM.
I'm adding a 20 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 20G 0 disk
That means, my new disk is /dev/sdb.
At the following steps, you need to change /dev/sdb to your disk device name.
Mark /dev/sdb as a PV
sudo pvcreate /dev/sdb
Create a VG named "myvg" using /dev/sdb
sudo vgcreate myvg /dev/sdb
First LV is 10 GB
sudo lvcreate -L 10G -n mylv1 myvg
Second LV is the rest (~10GB)
sudo lvcreate -l +100%FREE -n mylv2 myvg
sudo mkfs -t ext4 /dev/myvg/mylv1
sudo mkfs -t ext4 /dev/myvg/mylv2
Create mount points
sudo mkdir /mnt/mylv1
sudo mkdir /mnt/mylv2
Mount
sudo mount /dev/myvg/mylv1 /mnt/mylv1
sudo mount /dev/myvg/mylv2 /mnt/mylv2
Make them writable for everyone
sudo chmod 777 /mnt/mylv1
sudo chmod 777 /mnt/mylv2
Create 2 files of 100 MB for each LV
< /dev/urandom tr -dc "[:space:][:print:]" | head -c100M > /mnt/mylv1/d1f1
< /dev/urandom tr -dc "[:space:][:print:]" | head -c100M > /mnt/mylv1/d1f2
< /dev/urandom tr -dc "[:space:][:print:]" | head -c100M > /mnt/mylv2/d2f1
< /dev/urandom tr -dc "[:space:][:print:]" | head -c100M > /mnt/mylv2/d2f2
Check the contents of the LVs
ls -al /mnt/mylv1
ls -al /mnt/mylv2
sudo umount /mnt/mylv1
sudo umount /mnt/mylv2
sudo vgchange -an myvg
Check with pvscan
sudo pvscan
Export the VG
sudo vgexport myvg
Now it is time to unplug the 20 GB disk.
Output of lsblk -i
command after removing the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sudo apt update
sudo apt -y install lvm2
lsblk -i
command before adding the disk:NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
For physical servers, you need to add a disk to the hardware. For virtual servers you have to define it and attach it to the VM.
I'm adding a 20 GB disk to my VM.
Output of lsblk -i
command after adding the disk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 22.9G 0 disk
|-sda1 8:1 0 22G 0 part /
|-sda2 8:2 0 1K 0 part
`-sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 20G 0 disk
That means, my new disk is /dev/sdb.
sudo vgimport myvg
sudo vgchange -ay myvg
sudo mkdir /mnt/mylv1 /mnt/mylv2
sudo mount /dev/myvg/mylv1 /mnt/mylv1
sudo mount /dev/myvg/mylv2 /mnt/mylv2
Check the contents of the LVs
ls -al /mnt/mylv1
ls -al /mnt/mylv2
The following subjects are not covered in this tutorial: