Layer upon layer of abstraction can complicate this procedure. The common case is that a logical volume is running out of space and needs to be expanded. This can all be done non-destructively and while the volume is in use. It can be expanded by adding a SCSI disk within VMWare or by increasing the size of an existing SCSI disk in VMware. There may be some SAN level commands required first, and those will vary by the kind of SAN connected to VMWare. This specific recipe is based on first increasing the size of an existing SCSI disk in VMWare.
Step One - tell Linux to check the size of the SCSI disk that was expanded in VMWare.
Initially, Linux will not see any changes in the disk configuration. To see all the SCSI devices the system knows about, run:
ls /sys/class/scsi_device/
0:0:0:0 0:0:1:0 0:0:2:0
Once the expanded disk is identified, enable a rescan on the device:
echo 1 > /sys/class/scsi_device/0\:0\:2\:0/device/rescan
Then, run pvdisplay to make sure the physical volume shows the new size. Also, note in the output which volume group the physical volume is assigned to for the next step.
Step Two - make the sure the volume group shows free space
vgdisplay volume-group-name
Check to verify the volume group now has free space.
Step Three - expand the logical volume
Run the following command (replacing the logical-volume with the correct name) to expand the logical volume using ALL available free space in the volume group. If that's not what you want, check the syntax of lvexpand to add the amount of space you want to use.
lvextend -l +100%FREE logical-volume
Step Four - expand the Linux filesystem
Ext3/4 and XFS filesystems can be expanded
resize2fs /dev/mapper/vg-name/lv-name
OR
xfs_growfs /dev/mapper/vg-name/lv-name
No comments:
Post a Comment