Warning - this is an advanced topic. Always back up your data first. |
Most of our Linux / CentOS installations work with LVM. This can be extended - provided the system recognizes a plate enlargement or new plate - as follows. Here is the procedure for a disk expansion.
Step 1 - Determining the current config
|
The information above is now needed below.
Troubleshooting (already):
Sometimes, you might see output from frisk -l which looks strange.
For example, you have several disks reported in /dev like this:
/dev/sda
/dev/sda1
/dev/sda2
/dev/sda3
However, fdisk -l reports something strange like this:
Device Boot Start End Blocks Id System
/dev/sda1 1 134217727 67108863+ ee GPT
Partition 1 does not start on physical sector boundary.
Therefore, not all of the /dev/sda* disks are visible. This means the disk has been resized in the background, but the OS cannot read the partitions correctly.
The best way to fix this is using parted.
Run parted on the disk, and then input print.
You will be then asked for a couple of fixes. Input Fix at each point, then then quit.
Now running fdisk -l should give the correct output.
Here is an example run:
[root@con-jtel-dbm-2 ~]# parted /dev/sda GNU Parted 3.1 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? Fix/Ignore/Cancel? Fix Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 134217728 blocks) or continue with the current setting? Fix/Ignore? Fix Model: Msft Virtual Disk (scsi) Disk /dev/sda: 137GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 211MB 210MB fat16 EFI System Partition boot 2 211MB 1285MB 1074MB xfs 3 1285MB 68.7GB 67.4GB lvm (parted) quit |
Step 2 - Creating a new partition
Here it is necessary to know where the additional space can be found. There are 2 variants - either a new plate, or an extended plate.
In both cases, a new partition is created. Here in this example, the existing plate was extended. If a new disk was added, it can be found on /dev/sdb or /dev/sdc etc.
Adjust the commands below and the partition number (for a new disk, the partition will be 1) accordingly.
|
Step 3 - Adoption into LVM - Create Device
|
Step 4 - Expand Volume Group
|
Step 5 - Extend Logical Volume
|
Step 6 - Extend File System
|
|
Step 7 - Check final result!
|