This discussion is archived
3 Replies Latest reply: Jan 15, 2013 5:01 AM by DBagy RSS

Shrink size of virtual disk

DBagy Newbie
Currently Being Moderated
Hi,
I converted physical server to virtual machine using P2V method. Now I have 150GB virtual disk which has linux host and data is consuming only 30GB, the rest is free. What would I like is to shrink vdisk size to, lets say, 40GB because I don't need any more space. Is there any way to copy only data to another vdisk within OracleVM or shrink size of the disk without losing data?

Thanks.
  • 1. Re: Shrink size of virtual disk
    Rudi Newbie
    Currently Being Moderated
    I think that as long as its not the root disk,this should be possible
    I would do the following (assuming its a Linux guest) :
    Create a virtual disk
    Assign the virtual disk to the guest
    Create a partition and ext3 FS on of the new disk
    Copy the data from the guest
    Drop the old disk

    Btw,I think that the disks are sparse,i.e not really using 150 Gb of storage

    Rudi

    Edited by: Rudi on Dec 23, 2012 5:27 AM
  • 2. Re: Shrink size of virtual disk
    rvalencia Newbie
    Currently Being Moderated
    good,

    Currently there are available the option of P2V: Shrink size of virtual disk.

    I recommend the following:

    OPTION 1: vmware converter.
    1. - Convert from VMware Converter VMware VM (Shrink size of virtual disk).
    2. - Then with Oracle VM Manager, perform the conversion to oracle vm vmware vm.
    3. - Done.

    OPTION 2: Perform OS-level backup.
    1. - Perform Backup gunzip OS level.
    2. - Restores level OS on a new VM.
    3.-Done.

    Greetings.
  • 3. Re: Shrink size of virtual disk
    DBagy Newbie
    Currently Being Moderated
    Hi, thx for help, I finally did it.
    Steps:
    1. Boot up VM that needs to be shrinked with GParted Live CD
    2. Shrinked partition(dev/hda5) so that unneeded space is left as unallocated
    3. Created new hard disk with enough space and attached it to VM
    4. Booted up with GParted Live CD and copied all partitions to new disk(except unallocated partitions)
    5. Created new VM with new disk
    6. After that, I booted up new VM with Rescue Live CD, and entered into grub:
    6.1. grub>root (hd0,0)
    6.2. grub>setup (hd0)
    7. Reboot!

    Now I have the same VM, just it's using over 50GB less space. :)

    Thanks!

    Edited by: DBagy on Jan 15, 2013 5:00 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points