If a volume group created using a logical volume manager (LVM) is running out of space, you can expand it by adding a new drive to the volume group, then expanding the existing volume group partition onto the new drive.
Prerequisites
This procedure requires that the volume was originally created as an LVM volume group. The application volume on a DataIQ virtual machine created from a DataIQ OVA is preconfigured as an LVM volume group. Standard Linux volumes can also be expanded, however, the process is more complex and is outside of the scope of this document.
About this task
NOTE A common cause of the DataIQ application volume running out of space is that DataIQ is configured to store a large amount of historical storage monitoring data. As an alternative to expanding the drive, you can instead change the storage monitoring data retention policy.
Steps
Log into the DataIQ server and open a command prompt.
Optional: Confirm that the size of the logical volume and note how full it is:
df -h /
Sample output:
[root@centos76 ~]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 26G 22G 4G 85% /
Add a physical drive to the server.
Linux adds the drive using a disk name, for example, /dev/sdb.
Identify the disk name for the drive you just added.
fdisk -l
In this sample output, the disk name is /dev/sdb:
# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bde50
Device Boot Start End Blocks Id System
/dev/sdal * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 62914559 30407680 8e Linux LVM
Disk /dev/mapper/centos-root : 27.9 GB, 27913093120 bytes, 54517760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 3221 MB, 3221225472 bytes, 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
(Also note in this example, /dev/sda2 is the primary Linux LVM physical volume in the volume group.)
Create a new partition on the new drive and configure it:
Open the fdisk console, targeting the new drive:
fdisk /dev/sdb
Create a new primary partition, using the default partition values: n > p> press Enter 3 times to accept the defaults (partition = 1, use all available space on the drive).
Change the partition type to Linux LVM: type t > 8e.
Review the partition info that will be written: type p.
Sample output:
Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xa883580d
Device Boot Start End Blocks Id System
/dev/sdbl 2048 104857599 52427776 8e Linux LVM
Write the partition table and exit: type w.
Sample output:
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Create a new physical volume on the new partition, for example, /dev/sdb1.
pvcreate /dev/sdb1
Confirm that the physical volume has been created:
pvdisplay
In the sample output, the original physical volume, /dev/sda2, and the new physical volume, /dev/sdb1, are shown:
[root@centos ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size <23.80 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7423
Free PE 0
Allocated PE 7423
PV UUID 4g3yVT-3i7e-s xgH-EOGx-aykB-83xs-JxLCj6
"/dev/sdbl" is a new physical volume of "<50.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdbl
VG Name <50.00 GiB
PV Size NO
Allocatable 0
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID qa7tv0-ryIa-kTec-E81o-RSxa-HpLz-wlPHOk
Identify the volume group name (VG Name) of the volume group that you want to expand:
vgdisplay
For example, in this output, the only volume group is centos:
[ root@centos76 -]# vgdisplay
- Volume group —
VG Name centos
System ID
Format Lvmz
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <29.00 GiB
PE Size 4.00 MiB
Total PE 7423
Alloc PE / Size 7423 / <29.00 GiB
Free PE / Size 0/0
VG UUID omT41C-L5Oq-393P-LxHN-XO6q-0oi8-2blglP
Add the physical volume which we created earlier to the volume group:
vgextend centos /dev/sdb1
Confirm the logical volume path (LV Path)
lvdisplay
In this sample output, the logical volume path is /dev/centos/root.
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID wC9BlK-qeG5-tj2f-oQtN-AKTP-xfGA-fxk4JT
LV Write Access read/write
LV Creation host, time sarje-dpcwin2kl2r2.dpc.sso, 2019-07-02 05:43:34 -0400
LV Status available
# open 2
LV Size 3.00 GiB
Current LE 768
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID XKVxr8-GFfq-XoKa-ytkb-Mloe-nVig-0j01mf
LV Write Access read/write
LV Creation host, time sarje-dpcwin2kl2r2.dpc.sso, 2019-07-02 05:43:35 -0400
LV Status available
# open 1
LV Size <26.00 GiB
Current LE 6655
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
Extend the logical volume using the space in the newly-created physical volume:
lvextend /dev/centos/root /dev/sdb1
Resize the file system to make use of the space:
xfs_growfs /dev/centos/root
Confirm that the size of the logical volume has changed:
df -h /
Sample output:
[root@centos76 ~]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 76G 22G 54G 29% /
Data is not available for the Topic
Please provide ratings (1-5 stars).
Please provide ratings (1-5 stars).
Please provide ratings (1-5 stars).
Please select whether the article was helpful or not.
Comments cannot contain these special characters: <>()\