Questions

Ho do I extend the size of a virtual hard disk?

+
0 Votes
Locked

Ho do I extend the size of a virtual hard disk?

trvlrs
I am running Fedora 15 in a VirtualBox VM. I increased the size of the hard disc in the VM but the fedora OS is not recognizing the added space. how do i get fedora to recognize it? This is what fedora sees currently.

# # df

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
10061944 9536968 5604 100% /
/dev/hda1 101086 19782 76085 21% /boot
-bash: [root@profiles1: command not found
tmpfs 513060 0 513060 0% /dev/shm
/dev/hdc 39800 39800 0 100% /media/VBOXADDITIONS_4.0.12_72916

# fdisk -l | grep Disk

Disk /dev/hda: 85.8 GB, 85899345920 bytes

# df -H

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
11G 9.8G 5.8M 100% /
/dev/hda1 104M 21M 78M 21% /boot
tmpfs 526M 0 526M 0% /dev/shm
/dev/hdc 41M 41M 0 100% /media/VBOXADDITIONS_4.0.12_72916

As you can see the "fdisk -l | grep Disk" command shows the 85.8 GB but the df command does not recognize the added space.

Anyone know how to get this to work?

Rick
  • +
    0 Votes
    markp24

    Hi

    i looked this one up, here are two quotes from a virtaul boax link
    please see
    https://forums.virtualbox.org/viewtopic.php?t=10348

    but here are quotes of the two posts that may help you
    Re: increase size of virtual disk
    by SemiTech ?? 20. Sep 2011, 06:43

    I finally succeeded in increasing the size of my Windows 7 virtual hard drive. It was a multi-step process.

    First, I used the Mac's Time Machine backup system to restore the files in my VirtualBox folder to a time and state before I attempted to increase my virtual hard drive size. This was also a time before I deleted one of two snapshots. The goal was to be able to delete all snapshots or merge them into the current state. I believe you can't extend the size of your virtual disk with snapshots around.

    Using Time Machine (or back up of your choice) I restored all snapshots, vdi, and xml files to the earlier time.

    After these files were restored, I used the VBoxMange GUI to delete the newest of the snapshots (do not do this in the Mac Finder!). Then, from the VBox Manage GUI, I restored the Windows VM to the first, oldest, snapshot. Thus, the new "current state" became that of the first snapshot, which is what I wanted. Thus, no more "snapshots" - only a current state.

    With only the "current state" showing in the VirtualBox Manager, I now used the command line tool, VBoxManage, with the modifyhd command. Consult the VirtualBox PDF help manual, Chapter 8, on usage.

    VBoxManage modifyhd <path to vdi> --resize 40960.

    VBoxManage reported success, but the disk size didn't change in Windows (as reported in the Computer window).

    This is where I had to use the built-in Windows utility called DISKPART. In the Windows search box type "run" to get a command line window, then type DISKPART. Use the DISKPART utility to extend (expand) the volume or partition with focus, and its file system, into the free (unallocated) space on a disk.

    Type DISKPART "help extend" for a manual-like help file on using the DISKPART tool. At the end of the help you will see an example code for extending (expanding) your disk space.

    Example:
    EXTEND SIZE=40960 DISK=0
    EXTEND FILESYSTEM

    You must have previously selected (DISKPART>select volume or disk) a volume or partition for this to work. Use DISKPART>list disk and DISKPART>list disk to see your disks and volumes before taking any action. (I believe that I selected the volume before using the EXTEND commands.)


    OR

    you can do this

    by vkov_tinsky ?? 9. Oct 2008, 14:57

    Hi,

    You could try something like this (see also Tutorial - All about VDIs: How can I resize the partitions inside my VDI?):

    1.Create a new VDI of the desired size.
    2.Boot GParted Live in a VM with both old and new VDIs attached.
    3.Check in the partition editor (opened automatically after booting) what your old and new disk locations are. (It'll be something like /dev/hda and /dev/hdb.)
    4.Copy contents from old to new disk. This will take a fair amount of time. (Here /dev/hdX is your original disk and /dev/hdY the new one).

    Code: Select all Expand viewCollapse view
    dd if=/dev/hdX of=/dev/hdY???Warning: Make sure you do not mix up your input and output disks or you'll wipe all information from your original disk! (if= specifies the input and of= specifies the output.)
    5.Reboot (again with GParted-Live). Now you should be able to increase the Windows partition size on the new disk.
    Once you've verified the larger VDI boots Windows fine (and disk size is as you'd expect) you can of course delete the old smaller VDI.

    Edit: Instead of rebooting before you resize the partition you should be able to run partprobe and the hit CTRL+R in GParted instead.

    +
    0 Votes
    trvlrs

    I found this on another site and it was the easiest thing in the wourld.

    Adding more disk space with LVM2
    Posted in May 1st, 2009
    by Dennis in System Administration
    Tags: disk space, linux, lvm

    I've always known that virtualizing things can make management of all types of resources easier. Recently, I had the most pleasant experience adding disk space to a virtual machine. Of course, if you use LVM, this can happen just as easily with real physical disks, but for me, I was able to do this without restarting my machine.

    Issue: I'm out of disk space on my root partition.
    Solution: The root partition is created on a logical volume with LVM2. Just add another disk, extend the volume group, and then extend the logical volume.


    # Added new physical partition /dev/sda3
    # create a physical volume out of it
    > pvcreate /dev/sda3
    # Now, add it to the volume group that my logical volume is on
    > vgextend VolGroup00 /dev/sda3
    # Now that the volume group has more disk space, the logical volume can grow
    > lvextend -L+11G /dev/VolGroup00/LogVol00
    # Ok, last of all, I want to filesystem to recognize that more space is available
    > fsadm resize /dev/VolGroup00/LogVol00
    # sweet, I have more space now
    > df -h


    All that was done without having to take the system off line. Linux makes life easy sometimes doesn't it!

    +
    0 Votes
    markp24

    hello ,

    Thank you for posting that, i have to keep in in my notes, We (probably like everyone else) are migrating alot of systems to Virtual servers. So far we have not needed to increase hard disk sizes. But will keep these notes handy.

  • +
    0 Votes
    markp24

    Hi

    i looked this one up, here are two quotes from a virtaul boax link
    please see
    https://forums.virtualbox.org/viewtopic.php?t=10348

    but here are quotes of the two posts that may help you
    Re: increase size of virtual disk
    by SemiTech ?? 20. Sep 2011, 06:43

    I finally succeeded in increasing the size of my Windows 7 virtual hard drive. It was a multi-step process.

    First, I used the Mac's Time Machine backup system to restore the files in my VirtualBox folder to a time and state before I attempted to increase my virtual hard drive size. This was also a time before I deleted one of two snapshots. The goal was to be able to delete all snapshots or merge them into the current state. I believe you can't extend the size of your virtual disk with snapshots around.

    Using Time Machine (or back up of your choice) I restored all snapshots, vdi, and xml files to the earlier time.

    After these files were restored, I used the VBoxMange GUI to delete the newest of the snapshots (do not do this in the Mac Finder!). Then, from the VBox Manage GUI, I restored the Windows VM to the first, oldest, snapshot. Thus, the new "current state" became that of the first snapshot, which is what I wanted. Thus, no more "snapshots" - only a current state.

    With only the "current state" showing in the VirtualBox Manager, I now used the command line tool, VBoxManage, with the modifyhd command. Consult the VirtualBox PDF help manual, Chapter 8, on usage.

    VBoxManage modifyhd <path to vdi> --resize 40960.

    VBoxManage reported success, but the disk size didn't change in Windows (as reported in the Computer window).

    This is where I had to use the built-in Windows utility called DISKPART. In the Windows search box type "run" to get a command line window, then type DISKPART. Use the DISKPART utility to extend (expand) the volume or partition with focus, and its file system, into the free (unallocated) space on a disk.

    Type DISKPART "help extend" for a manual-like help file on using the DISKPART tool. At the end of the help you will see an example code for extending (expanding) your disk space.

    Example:
    EXTEND SIZE=40960 DISK=0
    EXTEND FILESYSTEM

    You must have previously selected (DISKPART>select volume or disk) a volume or partition for this to work. Use DISKPART>list disk and DISKPART>list disk to see your disks and volumes before taking any action. (I believe that I selected the volume before using the EXTEND commands.)


    OR

    you can do this

    by vkov_tinsky ?? 9. Oct 2008, 14:57

    Hi,

    You could try something like this (see also Tutorial - All about VDIs: How can I resize the partitions inside my VDI?):

    1.Create a new VDI of the desired size.
    2.Boot GParted Live in a VM with both old and new VDIs attached.
    3.Check in the partition editor (opened automatically after booting) what your old and new disk locations are. (It'll be something like /dev/hda and /dev/hdb.)
    4.Copy contents from old to new disk. This will take a fair amount of time. (Here /dev/hdX is your original disk and /dev/hdY the new one).

    Code: Select all Expand viewCollapse view
    dd if=/dev/hdX of=/dev/hdY???Warning: Make sure you do not mix up your input and output disks or you'll wipe all information from your original disk! (if= specifies the input and of= specifies the output.)
    5.Reboot (again with GParted-Live). Now you should be able to increase the Windows partition size on the new disk.
    Once you've verified the larger VDI boots Windows fine (and disk size is as you'd expect) you can of course delete the old smaller VDI.

    Edit: Instead of rebooting before you resize the partition you should be able to run partprobe and the hit CTRL+R in GParted instead.

    +
    0 Votes
    trvlrs

    I found this on another site and it was the easiest thing in the wourld.

    Adding more disk space with LVM2
    Posted in May 1st, 2009
    by Dennis in System Administration
    Tags: disk space, linux, lvm

    I've always known that virtualizing things can make management of all types of resources easier. Recently, I had the most pleasant experience adding disk space to a virtual machine. Of course, if you use LVM, this can happen just as easily with real physical disks, but for me, I was able to do this without restarting my machine.

    Issue: I'm out of disk space on my root partition.
    Solution: The root partition is created on a logical volume with LVM2. Just add another disk, extend the volume group, and then extend the logical volume.


    # Added new physical partition /dev/sda3
    # create a physical volume out of it
    > pvcreate /dev/sda3
    # Now, add it to the volume group that my logical volume is on
    > vgextend VolGroup00 /dev/sda3
    # Now that the volume group has more disk space, the logical volume can grow
    > lvextend -L+11G /dev/VolGroup00/LogVol00
    # Ok, last of all, I want to filesystem to recognize that more space is available
    > fsadm resize /dev/VolGroup00/LogVol00
    # sweet, I have more space now
    > df -h


    All that was done without having to take the system off line. Linux makes life easy sometimes doesn't it!

    +
    0 Votes
    markp24

    hello ,

    Thank you for posting that, i have to keep in in my notes, We (probably like everyone else) are migrating alot of systems to Virtual servers. So far we have not needed to increase hard disk sizes. But will keep these notes handy.