Before Resizing The Logical Volume

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Before Resizing The Logical Volume as PDF for free.

More details

  • Words: 935
  • Pages: 12
Increasing Oracle Enterprise Linux Disk Resource in a VMware Environment. February 15, 2008 Zachary Buckholz [email protected] Summary: This document provides step-by-step instructions for increasing the disk resources for a VMware guest system running Oracle Enterprise Linux under VMware 3.x.

Using the VIC client right-click the VM Guest you are going to add disk resources to. When the context menu appears left-click “Edit Settings”

On the next screen left-click the “Add” button which is highlighted below.

On the next screen left-click the “Hard Disk” option, then left-click “Next”.

On the next screen “Create a new virtual disk” should be selected by default, if not select it and leftclick “Next”.

On the next screen set the disk size and location. Additional disks can always be added in the future so there is no need to over commit disk resources. Just add what is justified at this time. The “Location” option should be left at the default setting of “Store with the virtual machine”. Left-click “Next” to continue.

On the next screen the “Virtual Device Node” will default to the next available, leave everything alone here. Left-click “Next”.

On the next screen just left-click “Finish”.

On the next screen just left-click “Ok”.

The VIC screen will show the status of the task at the bottom, once it completes the VM Guest needs to rescan the SCSI bus to detect the new disk.

Log into the VM Guest and run the rescan-scsi-bus.sh shell script located under /root as the root user. If the rescan-scsi-bus.sh shell script is not available on the system, it can be obtained from http://bash.cyberciti.biz/diskadmin/rescan-scsi-bus.sh.php

[root@oelvm ~]# ./rescan-scsi-bus.sh Host adapter 0 (mptspi) found. Scanning hosts 0 channels 0 for SCSI target IDs 0 1 2 3 4 5 6 7 , LUNs 0 Scanning for device 0 0 0 0 ... OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: VMware Model: Virtual disk Type: Direct-Access Scanning for device 0 0 1 0 ... OLD: Host: scsi0 Channel: 00 Id: 01 Lun: 00 Vendor: VMware Model: Virtual disk Type: Direct-Access Scanning for device 0 0 2 0 ... NEW: Host: scsi0 Channel: 00 Id: 02 Lun: 00 Vendor: VMware Model: Virtual disk Type: Direct-Access 1 new device(s) found. 0 device(s) removed.

Rev: 1.0 ANSI SCSI revision: 02

Rev: 1.0 ANSI SCSI revision: 02

Rev: 1.0 ANSI SCSI revision: 02

Now the logical volume can be extended using the LVM tools. Issue an fdisk –l to list the current disks and partitions, and obtain the new device name assigned by the system to the new disk. The new disk is highlighted below. [root@oelvm ~]# fdisk –l

Disk /dev/sda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot /dev/sda1 * /dev/sda2

Start 1 14

End 13 1044

Blocks 104391 8281507+

Id 83 8e

System Linux Linux LVM

Disk /dev/sdb: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table

Now create a physical lvm disk by issuing pvcreate [root@oelvm ~]# pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created

Next extend the volume group to include the newly created physical lvm disk using the vgextend command. Issue a vgdisplay to obtain the volume group name. The volume group is highlighted below.

[root@oelvm ~]# vgdisplay --- Volume group --VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 37.84 GB PE Size 32.00 MB Total PE 1211 Alloc PE / Size 1211 / 37.84 GB Free PE / Size 0 / 0 VG UUID 8tTsHh-fyUb-9tlj-9FVy-eTwB-9Wwc-s5amEJ

Now extend the volume group, passing as parameters the Volume Group name and the new physical LVM device. [root@oelvm ~]# vgextend VolGroup00 /dev/sdc Volume group "VolGroup00" successfully extended Next extend the logical volume to include 100% of the newly added free space in the volume group. [root@oelvm ~]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 44.81 GB Logical volume LogVol00 successfully resized

The last step is to increase the file system size to include the newly created logical volume disk space. Use the Linux resize2fs command and pass as a parameter the Logical Volume device. [root@oelvm ~]# resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.39 (29-May-2006) Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required Performing an on-line resize of /dev/VolGroup00/LogVol00 to 11747328 (4k) blocks. The file system on /dev/VolGroup00/LogVol00 is now 11747328 blocks long.

Before resizing the Logical Volume: (3.2 GB free space) Initial VM Guest [root@oelvm ~]# df –h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 6.7G 3.2G 3.2G 51% / /dev/sda1 99M 19M 75M 21% /boot tmpfs 250M 0 250M 0% /dev/shm

After adding a new disk in the VMware Console, and resizing the Logical Volume: (31 GB free space) After adding one 20GB disk [root@oelvm ~]# df –h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 36G 3.3G 31G 10% / /dev/sda1 99M 19M 75M 21% /boot tmpfs 250M 0 250M 0% /dev/shm After adding another disk and resizing the file system: (44 GB free space) After adding one 8GB disk [root@oelvm ~]# df –h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 44G 7.0G 35G 17% / /dev/sda1 99M 19M 75M 21% /boot tmpfs 250M 0 250M 0% /dev/shm

Related Documents