Posted on 06-14-2012 05:07 AM
When I convert the OVA to a VM image it insists on provisioning all the space (i.e. 100GB). I've mounted another drive (NFS) as /svr to keep my files elsewhere - now I want to shirnk/reduce the size of the Netboot VM. Any ideas?
Posted on 09-20-2013 02:00 PM
reboot the VM.
When the VM comes back up login to shelluser
At the prompt type in the following
$ sudo fdisk –l
Take note of this because we will compare disk con figurations to verify that the drive has been added.
At the prompt type in the following
$ sudo fdisk /dev/sda
It will ask you “Command (m for help): “ you will type in “n” to create a new partition and hit enter.
Next it will prompt you for another command action. Type in P and hit enter.
Next it will ask “Partition number (1-4)” you will type in 3 and hit enter
Then it will show you the first cylinder and you have the ability to type in a number. Just hit enter and it will default to the first available cylinder.
Then it will show you the last cylinder and the same thing. Enter will default to the very last cylinder available.
Next it will prompt you “Command (m for help):” type in “w” and hit enter to write this partition to the disk.
Reboot the VM again.
Now that we have added a new drive in the VM using the disk space recently extended to the VM we now need to extend the existing volume to use the new drive we just added so it is one volume.
Log in as shell user again.
Type in the following command
$ sudo pvcreate /dev/sda3
It should respond with “Physical volume “/dev/sda3” successfully created” This is creating a mount point for the disk that represents the volume.
$ sudo vgdisplay
This will display the volume groups. In this case it should be “ubuntu”
Now to extend the volume type in
$ sudo vgextend Ubuntu /dev/sda3
it should respond with “Volume group “ubuntu” successfully extended”
now to extend the logical volume. First we need to determine what it is.
$ sudo lvs
This will return the logical volumes and in this case it should be “root”
Now that we know root is the logical volume we can type in the command that will extend the logical volume to use the newly added drive space.
$ sudo lvextend /dev/Ubuntu/root /dev/sda3
you should get the following returned
“Extending logical volume root to <new total drive space>”
“Logical volume root successfully resized”
Last command to extend the disk formatting to the additional space so the file system can use it.
$ sudo resize2fs /dev/Ubuntu/root
It will respond with something along the lines of the lines below. Just replace VolGroup00 with Ubuntu and LogVol00 with root.
“resize2fs 1.39 (29-May-2006)”
“File system at dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
preforming an on-line resize of /dev/VolGroup00/LogVol00 to 2457600 (4k) blocks.
The file system on /dev/VolGroup00/LogVol00 is now 2457600 blocks long.