(RPM) Capacity expansion for Linux virtual machines under VMware

Source: Internet
Author: User
Tags vmware fusion gparted

"Well, here's another fine mess you ' ve gotten me into"

Let us pretend so you had an Ubuntu Server which had been running for several years and it had been doing it ' s assigned Task (s) nicely, until one day do a change to your methodology/assumptions/workflow/tasks therefore the allocated Vi Rtual hard Drive (VHD) size is no longer sufficient. There is many reasons for this, but I ran to this issue twice in one weekended because I enabled a JDS as a distributio N Point (thus MySQL is eating needing a lot of space) and wanting to test multiple NetBoot NBI sources (because 10.10.2 seems to be causing imaging troubles). I need to increase the size of both different VHDs, however if you setup your Ubuntu Server via "Easy Install Mode" Enlargi Ng The VHD is not that Strait forward.

Doing a quick search to see what VMware have to say about this issue returns less than helpful information for Ubuntu Serve RS by stating man fdisk . Google searching throws a lot of ideas, therefore I ' m providing what I ' ve learned from a couple of hours of the.

Increase size? I Don ' t think that word means what do you think it means

First lets get a baseline of a default "easy Install" of Ubuntu Server. We can see the we have a 20GB VHD by several ways:

    • Looking at our VMware Fusion Setup
    • Runningsudo fdisk -l
    • Runningdf -H

Here's my test VM as it stands right now. You can see the VHD settings was for 20GB (really 21.5, guessing there was a rounding error somewhere), and that our Primar Y partition is/dev/sda1 with 19GB drive.

 [email protected]:~$ sudo fdisk-ldisk/ dev/sda:21.5 GB, 21474836480 bytes255 heads, sectors/track, 2610 cylinders, total 41943040 sectorsunits = sectors of 1 * + = + bytessector size  (Logical/physical (minimum/optimal* 2048 37750783 18874368 2 37752830 41940991 2094081 5 extended/dev/sda5 37752832 41940991 2094080 Linux swap/solaris[email&n bsp;protected]:~$ Df-h | grep sda/dev/sda1 19G 1.4G 17G 8%/           

Now it would is really nice if VMware Fusion's tools to increase the VHD worked as expected. If we could just simply move our sliders (or type in a new value) for your desired HD space that would actually increase our Storage space, that's would be perfect!

Result VMware Fusion VHD setting after adjusting from 20GB to 30GB.

We start our Ubuntu Server to verify, we are now 30GB of storage and however what we see are the Virtual Environ ment believes we have 30GB (32.2 specifically) but OUR/DEV/SDA1 partition are still at 19gbs?!

 [email protected]:~$ sudo fdisk-ldisk/ dev/sda:32.2 GB, 32212254720 bytes255 heads, sectors/track, 3916 cylinders, total 62914560 sectorsunits = sectors of 1 * + = + bytessector size  (Logical/physical (minimum/optimal* 2048 37750783 18874368 2 37752830 41940991 2094081 5 extended/dev/sda5 37752832 41940991 2094080 Linux swap/solaris[email&n bsp;protected]:~$ Df-h | grep sda/dev/sda1 19G 1.4G 17G 8%/           

What we had done was expanded the allowable space to being used, but we didn ' t actually adjust the partition size. We need to do and some more awesome open source tools.

Steps to increase your VMware Fusion partition

First we is going to use a Linux Live CD called GParted. Download their 234MB iso to your VMware Fusion host so you can attached the ISO to the CD/DVD drive. Once attached, use the Startup Disk options on VMware Fusion to select the CD/DVD drive.

GParted attached as a CD/DVD drive, then booting from the drive.

Assuming you is a native 中文版 speaking individual and that you have a "US" keyboard setup, can safely hits the Ente R key for a couple of times to get to the GParted application. GParted would show you some critical information that we must overcome:

    • Our original partition of 20GB are at the beginning
    • Our swap space was in the middle
    • Our extra space are at the end

Unfortunately with this GUI application your cannot just "drag" or "move" the extra space next to our original drive to exp and your partition. Instead, we have to methodically move things around so everything lines up in the proper order. To does this we'll perform the following steps in order:

    • Enlarge the "extended" space to take over our unallocated area
    • Move Our swap space from the beginning to the end of our "extended" space
    • Truncate the "extended" space to only focus on the swap space
    • Enlarge our primary partition to use the new unallocated area

Select The/dev/sda2 "Extended" and resize/move to take over the unallocated area, and hits apply. Select The/dev/sda5 "Linux-swap" and Resize/move to the end of our extended area, and hits apply. Select The/dev/sda2 "Extended" to create new unallocated space preceding the "Linux-swap" space. Select the/dev/sda1 and Resize/move to take over our new unallocated area. Verify Our primary partition now have the 30GB storage (minus 2GB for swap in this example).

To verify everything was running again, change your startup disk back to your hard drive in VMware Fusion, restart your VM and run the same commands from the beginning.

[email protected]:~$ sudo fdisk -lDisk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000752bd Device Boot Start End Blocks Id System/dev/sda1 * 2048 58724351 29361152 83 Linux/dev/sda2 58724352 62914559 2095104 5 Extended/dev/sda5 58726400 62914559 2094080 82 Linux swap / Solaris[email protected]:~$ df -H | grep sda/dev/sda1 30G 1.4G 27G 5% /

Reference

https://www.justinrummel.com/resizing-a-vmware-fusion-ubuntu-server-virtual-hard-drive-via-easy-mode/

(RPM) Capacity expansion for Linux virtual machines under VMware

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.