Expanding LVM drives in VMWare

When I created this most recent batch of webservers, I got a little stingy with the drive space. I skimped on the “/” partition, and as you can see, I’m paying for it now:

[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2.5G 2.3G 80M 97% /
/dev/mapper/VolGroup00-LogVol04
29G 9.1G 19G 33% /apps
/dev/sda1 99M 13M 82M 14% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/mapper/VolGroup00-LogVol03
2.9G 37M 2.8G 2% /opt
/dev/mapper/VolGroup00-LogVol02
1008M 933M 25M 98% /var

Here’s how I was able to solve my problem.

1) Turn off the VM and expand the drive. (I’m adding 5 Gigs to “/” for a total of 7.5). I’m doing this thru the vmware VirtualCenter management software, but the documentation recommends the following command:

vmware-vdiskmanager -x 10GB /path/machineName.vmdk

2) After powering the VM back on, I now have to create a partition that will incorporate the new space:

[root@server ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 5874.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (5222-5874, default 5222):
Using default value 5222
Last cylinder or +size or +sizeM or +sizeK (5222-5874, default 5874):
Using default value 5874

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

Command (m for help): p

Disk /dev/sda: 48.3 GB, 48318382080 bytes
255 heads, 63 sectors/track, 5874 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 5221 41833260 8e Linux LVM
/dev/sda3 5222 5874 5245222+ 8e Linux LVM

Command (m for help): q

I now have 3 partitions, including my most recent, partition 3 that has been formatted to use LVM. Now I must reboot my VM so that it will include this partition in the table at reboot.

3) Now I must create a physical volume so that I can access my partition with LVM.

[root@server ~]# pvcreate /dev/sda3
Physical volume “/dev/sda3″ successfully created

4) Following that, I need to extend my VolGroup into my new physical Volume:

[root@server ~]# vgextend VolGroup00 /dev/sda3
Volume group “VolGroup00″ successfully extended

5) With that complete, I need to extend the logical volume into the newly created space. I know that I planned to give myself 5 gigs, but I want to see how the system is really going to give me, so I’m going to run:

[root@server ~]# vgdisplay | grep ‘Free’
Free PE / Size 165 / 5.16 GB

So now I can be sure that I have 5 GB to work with. I can run lvextend to grow my logical volume across the new partition:

[root@server ~]# lvextend -L+5G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 7.47 GB
Logical volume LogVol00 successfully resized

With that completed, I now have the Logical Volume sitting at 7.47 Gigs. I now need to expand the file system to take advantage of the space that was created. This step is normally taken care of with the resize2fs command, but since I’m running RHEL 4, I can take advantage of ext2online command and don’t have to take the filesystem down. I like this idea much better:

[root@server ~]# ext2online /dev/VolGroup00/LogVol00
ext2online v1.1.18 – 2001/03/18 for EXT2FS 0.5b

That’s it! Now when I run my df -h, I have all the space I was needing:

[root@oasslcwpa01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.4G 2.2G 4.9G 31% /
/dev/mapper/VolGroup00-LogVol04
29G 7.3G 21G 27% /apps
/dev/sda1 99M 13M 82M 14% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/mapper/VolGroup00-LogVol03
2.9G 192M 2.6G 7% /opt
/dev/mapper/VolGroup00-LogVol02
1008M 447M 511M 47% /var

Special thanks to swizzling.org, who’s tutorial I modified minimally for my own benefit here.




You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

100 Responses to “Expanding LVM drives in VMWare”

  1. TIMOTHY Says:


    Medicamentspot.com. Canadian Health&Care.Special Internet Prices.Best quality drugs.No prescription online pharmacy. Low price pills. Order pills online

    Buy:Prednisolone.Zovirax.Human Growth Hormone.Actos.Zyban.Lumigan.Prevacid.Synthroid.Mega Hoodia.Retin-A.Petcam (Metacam) Oral Suspension.100% Pure Okinawan Coral Calcium.Valtrex.Accutane.Arimidex.Nexium….

  2. BARRY Says:


    CheapTabletsOnline.com. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. No prescription drugs. Order drugs online

    Buy:Retin-A.100% Pure Okinawan Coral Calcium.Prevacid.Zyban.Actos.Accutane.Mega Hoodia.Zovirax.Nexium.Lumigan.Petcam (Metacam) Oral Suspension.Synthroid.Human Growth Hormone.Valtrex.Prednisolone.Arimidex….

  3. LONNIE Says:


    NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

  4. EVAN Says:

    ████████►BUY VIAGRA◀███████…

    ████████▲▲▲▲▲▲▲▲▲████████…

  5. LONNIE Says:

    abilify side effects in children

    Buydrugs without prescription…

  6. CLYDE Says:

    Cialis UK

    Buygeneric meds…

  7. COREY Says:

    Cialis UK

    Buynow it…

  8. ANDREW Says:

    order cialis in canada online

    Buyno prescription…

  9. EUGENE Says:

    Advair@official.site” rel=”nofollow”>.

    Buynow it…

  10. LYNN Says:

    aggrenox@1.now” rel=”nofollow”>.

    Buygeneric meds…

  11. HUBERT Says:

    dosage@of.albenza.for.human.hookworm.infection” rel=”nofollow”>..

    Buyno prescription…

  12. CLAYTON Says:

    cost@of.alesse” rel=”nofollow”>..

    Buyit now…

  13. SERGIO Says:

    aloe@vera.gel.indicatii” rel=”nofollow”>…

    Buygeneric drugs…

  14. KELLY Says:

    Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  15. GUY Says:

    avodart@in.usa” rel=”nofollow”>.

    Buyno prescription…

  16. LARRY Says:

    ..

    Buygeneric drugs…

  17. ENRIQUE Says:

    Aricept@official.site” rel=”nofollow”>.

    Buynow…

  18. ALBERTO Says:

    Augmentin@official.site” rel=”nofollow”>.

    Buywithout prescription…

  19. RICK Says:

    Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  20. RICK Says:

    celexa@canada.now” rel=”nofollow”>.

    Buynow…

  21. FREDDIE Says:

    cipro@250.mg” rel=”nofollow”>..

    Buygeneric meds…

  22. ENRIQUE Says:

    generic@Cialis.now” rel=”nofollow”>.

    Buynow…

  23. MITCHELL Says:

    buy@Viagra.now” rel=”nofollow”>…

    Buygeneric pills…

  24. JORDAN Says:

    < a href="http://my.gardenguides.com/members/buy-Cialis? buy@Cialis.now

    Buydrugs without prescription…

  25. RON Says:

    cheap@Viagra.now” rel=”nofollow”>…

    Buygeneric pills…

  26. DOUGLAS Says:

    Abilify@official.site” rel=”nofollow”>…

    Buynow…

  27. HUBERT Says:

    Abilify@official.site” rel=”nofollow”>…

    Buynow it…

  28. CURTIS Says:

    depakote@classification.now” rel=”nofollow”>..

    Buygeneric drugs…

  29. DARRYL Says:

    e-code for zometa

    Buyit now…

  30. JASON Says:

    zofran odt

    Buynow it…

  31. CLINTON Says:

    Zocor

    Buygeneric meds…

  32. RANDALL Says:

    zyrtec in dialysis patients

    Buywithout prescription…

  33. MAX Says:

    cats zanaflex

    Buydrugs without prescription…

  34. KENNETH Says:

    Zaditor

    Buydrugs without prescription…

  35. JESSIE Says:

    what is the generic drug for wellbutrin 150 sr

    Buyno prescription…

  36. STUART Says:

    Vytorin

    Buynow…

  37. ALFONSO Says:

    Zyvox

    Buydrugs without prescription…

  38. ANTHONY Says:

    buy liposomal lidocaine 4% cream maxilene

    Buywithout prescription…

  39. ORLANDO Says:

    Zoloft

    Buyit now…

  40. JULIO Says:

    zyrtec anticolinergici effect

    Buyno prescription…

  41. TROY Says:

    Zyrtec

    Buyit now…

  42. CALVIN Says:

    gilbert’s syndrome tylenol

    Buygeneric meds…

  43. CHAD Says:

    Zyprexa

    Buydrugs without prescription…

  44. LEONARD Says:

    rumalaya forte

    Buywithout prescription…

  45. CHRIS Says:

    Rogaine

    Buygeneric meds…

  46. DOUGLAS Says:

    zyprexa relprevv j-code

    Buygeneric drugs…

  47. BRYAN Says:

    side effect of zoloft

    Buyno prescription…

  48. KELLY Says:

    Retin A

    Buygeneric drugs…

  49. MANUEL Says:

    Omeprazole

    Buygeneric pills…

  50. ALFONSO Says:

    Pyridium

    Buydrugs without prescription…

  51. JIMMY Says:

    Pyrantel Pamoate

    Buygeneric meds…

  52. TERRANCE Says:

    howard county purim carnival 2010

    Buyno prescription…

  53. JEFF Says:

    Zyprexa

    Buynow it…

  54. AUSTIN Says:

    is overdosing on seroquel painful

    Buydrugs without prescription…

  55. JONATHAN Says:

    rogaine for thicker eyebrows

    Buynow…

  56. PAUL Says:

    risperdal and carbatrol interactions

    Buygeneric pills…

  57. DONNIE Says:

    prozac breast feeding

    Buydrugs without prescription…

  58. LUIS Says:

    Prozac

    Buygeneric meds…

  59. ROBERTO Says:

    low dose haldol and paxil

    Buygeneric drugs…

  60. TERRANCE Says:

    Pyrantel@Pamoate.now” rel=”nofollow”>..

    Buygeneric pills…

  61. BRIAN Says:

    Tylenol@Tylenol.Tylenol” rel=”nofollow”>…

    Buygeneric meds…

  62. JARED Says:

    Topamax@Topamax.Topamax” rel=”nofollow”>.

    Buyit now…

  63. CLAUDE Says:

    Tri@Cyclen.now” rel=”nofollow”>…

    Buyno prescription…

  64. GEORGE Says:

    Soma@Soma.Soma” rel=”nofollow”>.

    Buyno prescription…

  65. SAM Says:

    Purim@Purim.Purim” rel=”nofollow”>…

    Buygeneric drugs…

  66. CARLOS Says:

    Yaz

    Buygeneric pills…

  67. EDGAR Says:

    Singulair@Singulair.Singulair” rel=”nofollow”>…

    Buygeneric pills…

  68. TYRONE Says:

    Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric pills…

  69. LLOYD Says:

    risperdal@warnings.for.elderly” rel=”nofollow”>…

    Buynow it…

  70. JULIO Says:

    Cozaar@Cozaar.Cozaar” rel=”nofollow”>.

    Buynow it…

  71. DARREN Says:

    Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric drugs…

  72. JEREMY Says:

    Claritin@Claritin.Claritin” rel=”nofollow”>..

    Buyit now…

  73. SEAN Says:

    Singulair@Singulair.Singulair” rel=”nofollow”>.

    Buygeneric drugs…

  74. OLIVER Says:

    coral@calcium.ultra” rel=”nofollow”>…

    Buygeneric drugs…

  75. JAIME Says:

    buy@human.growth.hormone.product” rel=”nofollow”>…

    Buygeneric drugs…

  76. DUSTIN Says:

    early@childhood.purim.crafts” rel=”nofollow”>.

    Buygeneric drugs…

  77. CLAUDE Says:

    ..

    Buygeneric drugs…

  78. DALE Says:

    Buydrugs without prescription…

  79. MANUEL Says:

    allegra@print.colorado.springs” rel=”nofollow”>…

    Buygeneric drugs…

  80. LLOYD Says:

    .

    Buynow…

  81. JORDAN Says:

    .

    Buywithout prescription…

  82. RALPH Says:

    rhinocort@vs.beconase” rel=”nofollow”>.

    Buyno prescription…

  83. EUGENE Says:

    dried@neem.leaves” rel=”nofollow”>…

    Buywithout prescription…

  84. KEITH Says:

    crestor@statin.drugs” rel=”nofollow”>…

    Buyit now…

  85. JERRY Says:

    .

    Buyno prescription…

  86. JULIAN Says:

    can@you.take.vicodin.with.prednisolone” rel=”nofollow”>.

    Buynow…

  87. FRANKLIN Says:

    effexor@drug.interaction” rel=”nofollow”>.

    Buygeneric pills…

  88. KIRK Says:

    alternatives@to.premarin” rel=”nofollow”>…

    Buygeneric pills…

  89. TROY Says:

    long@term.prilosec.use” rel=”nofollow”>.

    Buygeneric drugs…

  90. LEE Says:

    is@prometrium.and.blood.clots” rel=”nofollow”>..

    Buywithout prescription…

  91. SHAUN Says:

    cutting@proscar.tablets” rel=”nofollow”>.

    Buygeneric pills…

  92. RICKY Says:

    .

    Buygeneric drugs…

  93. ADRIAN Says:

    altace@generic.name” rel=”nofollow”>.

    Buynow it…

  94. CASEY Says:

    buy@online.amoxicillin” rel=”nofollow”>.

    Buywithout prescription…

  95. WESLEY Says:

    methotrexate@and.placenta.acretia” rel=”nofollow”>.

    Buygeneric drugs…

  96. FRED Says:

    neurontin@dyskinesia.tardive.dystonia” rel=”nofollow”>.

    Buygeneric drugs…

  97. WESLEY Says:

    how@well.does.nexium.cure.barretts.esophagus” rel=”nofollow”>.

    Buygeneric drugs…

  98. NORMAN Says:

    changing@from.paxil.to.paxil.cr” rel=”nofollow”>.

    Buyno prescription…

  99. OLIVER Says:

    side@effects.of.dog.medication.famotidine.and.flagyl” rel=”nofollow”>…

    Buygeneric drugs…

  100. ERNESTO Says:

    Buygeneric drugs…

Leave a Reply