Thứ Năm, 23 tháng 1, 2014

Extend Oracle Virtualbox VM disk size for Linux or Windows

You might need to extend/increase VM disk size in Oracle Virtual box
But there is no GUI tool available for virtual box right now. Instead you can use command to do this.



  1. Backup the existing vm disk file (*.vdi)
  2. Create empty VM disk by selecting Settings Menu of VM –> Storage –> Add Hard Disk –> Create new disk. and give bigger size you want to extend
  3. Use VBoxManage to clone hard disk
    • Open command line
    • Go to directoty: C:\Program Files\Oracle\VirtualBox
    • Type command: vboxmanage "old.vdi" "new.vdi"
  4. From VM settings remove old disk and attach new disk. 
  5. For Windows: using Disk Management to extend; for Linux: doing steps 
    •  Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
      # fdisk -l
    • Create a new primary partition:
      • Run the command:
        # fdisk /dev/sda
      • List all partitions by pressing p. By default there are 2 partitions: /dev/sda1 and /dev/sda2
      • Press n to create new primary partition
      • Press p for primary
      • Based on the existing partitions, choose next partition number: 3
      • Press Enter twice.
      • Save all changes by pressing w
    • Restart VM
    • Check all changes:
      # fdisk -l
    • Convert new partition to a physical volume:
      # pvcreate /dev/sda3
    • Determine which volume group to extend:
      # vgdisplay
    • Extend the physical volume:
      # vgextend VolGroup00 /dev/sda3
    • Specify how many physical extends:
      # vgdisplay VolGroup00 | grep "Free"
    • Extend logical volume:
       # lvextend -L+#G /dev/VolGroup00/LogVol00
      (#: number of free space we want to extend)
    • Expand the ext3 filesystem online
      # resize2fs /dev/VolGroup00/LogVol00
    • Verify new space
      # df -h 
See more: http://technicalconfessions.com/posts.php?post_id=80&title=HOW%20TO:%20Expand%20existing%20hard%20drive%20space%20on%20a%20VM%20Oracle%20Linux

Không có nhận xét nào:

Đăng nhận xét