You are on page 1of 3

2/25/2014 VMware KB: Extending a logical volume in a virtual machine running Red Hat or Cent OS

Knowledge Base

Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371)

Purpose

This article provides steps for extending the root partition residing in a logical volume created with Logical Volume M anager (LVM ) in a virtual machine running Red Hat/Cent OS.

Resolution

To extend the logical volume:

Note: These steps only apply to EXT3 file systems.

Caution: VMware recommends having a complete backup of the virtual machine prior making these changes.

1. Power off the virtual machine.


2. Edit the virtual machine settings and extend the virtual disk size. For more information, see Increasing the size of a virtual disk (1004047) (http://kb.vmware.com/kb/1004047) .
3. Power on the virtual machine.
4. Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:

# fdisk -l

5. Create a new primary partition:


a. Run the command:

# fdisk /dev/sda (depending the results of the step 4)

b. Press p to print the partition table to identify the number of partitions. By default there are 2: sda1 and sda2.
c. Press n to create a new primary partition.
d. Press p for primary.
e. Press 3 for the partition number, depending the output of the partition table print.
f. Press Enter two times.
g. Press t to change the system's partition ID
h. Press 3 to select the newly creation partition
i. Type 8e to change the Hex Code of the partition for Linux LVM
j. Press w to write the changes to the partition table.

6. Restart the virtual machine.


7. Run this command to verify that the changes were saved to the partition table and that the new partition has an 8etype:

# fdisk -l

8. Run this command to convert the new partition to a physical volume:

# pvcreate /dev/sda3

9. Run this command to extend the physical volume:

# vgextend VolGroup00 /dev/sda3

Note: To determine which volume group to extend, use the command vgdisplay.

10. Run this command to verify how many physical extents are available to the Volume Group:

# vgdisplay VolGroup00 | grep "Free"

11. Run the following command to extend the Logical Volume:

# lvextend -L+#G /dev/VolGroup00/LogVol00

Where # is the number of Free space in GB available as per the previous command. Use the full number output from Step 10 including any decimals.

Note: to determine which logical volume to extend, use the command lvdisplay.

12. Run the following command to expand the ext3 filesystem online, inside of the Logical Volume:

# ext2online /dev/VolGroup00/LogVol00

Note: Use resize2fsinstead of ext2onlineif it is not a Red Hat virtual machine.

13. Run the following command to verify that the / filesystem has the new space available:

# df -h /

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006371 1/3
2/25/2014 VMware KB: Extending a logical volume in a virtual machine running Red Hat or Cent OS

Additional Information

For more information, see The Linux Logical Volume Manager from Redhat (http://www.redhat.com/magazine/009jul05/features/lvm2/) .

Note: The preceding link was correct as of Jan 29, 2014. If you find that the link is b roken, please provide feedb ack and a VMware employee will update the link.

For translated versions of this article, see:

• Español: Extensión de un volumen lógico en una máquina virtual con Red Hat o SO Cent (2046756) (search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=2046756)
• Português: Como estender um volume lógico em uma máquina virtual executando o Red Hat ou Cent OS (2046064) (search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=2046064)

See Also

Como estender um volume lógico em uma máquina virtual executando o Red Hat ou Cent OS (javascript:openDocumentLink('2046064',''))
Extensión de un volumen lógico en una máquina virtual con Red Hat o SO Cent (javascript:openDocumentLink('2046756',''))

Update History

04/24/2012 - Removed outdated article, checked links.


03/15/2011 - Updated title to reflect content.
07/17/2012 - Added note about vgdisplay and lgdisplay commands
01/17/2014 - Added guest feedback regarding the partprobe command.

Request a Product Feature

To request a new product feature or to provide feedback on a VM ware product, please visit the Request a Product Feature (http://www.vmware.com/contact/contactus.html?department=prod_request) page.
Permalink to: Extending a logical volume in a virtual machine running Red Hat or Cent OS (http://kb.vmware.com/kb/1006371)

Read our blog (http://blogs.vmware.com/kb/) Watch KBTV (http://blogs.vmware.com/kbtv/) Follow us (http://www.twitter.com/vmwarekb) Request New Content (http://www.vmware.com/landing_pages/knowledgebase-content-
request.html)

1 (javascript:void( rate(1,this) ))
2 (javascript:void( rate(2,this) ))
3 (javascript:void( rate(3,this) ))
4 (javascript:void( rate(4,this) ))
5 (javascript:void( rate(5,this) ))

107 Ratings
Actions
Bookmark Document (javascript:addBookmark(actionBoxUtil.docURL, actionBoxUtil.docTitle);)
Email Document (javascript:emailDoc(actionBoxUtil.extId, actionBoxUtil.sliceId, actionBoxUtil.docTitle, actionBoxUtil.cpplay er, actionBoxUtil.bbid))
Print Document (javascript:window.print())
Subscribe to Document (/selfservice/microsites/microsite.do?cmd=display KC&docTy pe=kc&docTy peID=DT_KB_1_1&externalId=1006371&format=rss)

(http://www.addthis.com/bookmark.php?v=250&username=xa-4b5f42f36e60a29e)

KB: 1006371

Updated: Feb 12, 2014


Categories:
How to
Informational
Languages:
English

Product(s):
VM ware ACE
VM ware ESX
VM ware ESXi
VM ware Fusion
VM ware GSX Server
VM ware Server
VM ware Workstation

Product Version(s):
VM ware ACE 2.5.x
VM ware ACE 2.6.x
VM ware ACE 2.7.x
VM ware ESX 4.0.x
VM ware ESX 4.1.x
VM ware ESXi 4.0.x Embedded
VM ware ESXi 4.0.x Installable
VM ware ESXi 4.1.x Embedded
VM ware ESXi 4.1.x Installable
VM ware ESXi 5.0.x
VM ware ESXi 5.1.x
VM ware ESXi 5.5.x
VM ware Fusion 1.x
VM ware Fusion 2.x
VM ware Fusion 3.x
VM ware Fusion 4.x
VM ware Fusion 5.x
VM ware Fusion 6.x
VM ware GSX Server 2.x (Linux)
VM ware GSX Server 2.x (Windows)
VM ware GSX Server 3.x (Linux)
VM ware GSX Server 3.x (Windows)
VM ware Server 1.0.x (Linux)

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006371 2/3
2/25/2014 VMware KB: Extending a logical volume in a virtual machine running Red Hat or Cent OS
VM ware Server 1.0.x (Windows)
VM ware Server 2.0.x (Linux)
VM ware Server 2.0.x (Windows)
VM ware Workstation 10.x (Linux)
VM ware Workstation 10.x (Windows)
VM ware Workstation 3.x (Linux)
VM ware Workstation 3.x (Windows)
VM ware Workstation 4.x (Linux)
VM ware Workstation 4.x (Windows)
VM ware Workstation 5.x (Linux)
VM ware Workstation 5.x (Windows)
VM ware Workstation 6.x (Linux)
VM ware Workstation 6.x (Windows)
VM ware Workstation 7.x (Linux)
VM ware Workstation 7.x (Windows)
VM ware Workstation 8.x (Linux)
VM ware Workstation 8.x (Windows)
VM ware Workstation 9.x (Linux)
VM ware Workstation 9.x (Windows)

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006371 3/3

You might also like