1

(mods/admins/etc: This may or may not belong on Stack Overflow, let me know if putting it here was a mistake.)

I'm one of those guys that is always paranoid about disk space, so when my hard drive (Windows box) reached about 50% full, I decided it was time to expand. I stupidly chose to do so with a second hard drive and the Intel Matrix fake-RAID that came with the motherboard. The second hard drive is larger, so it isn't having the full space used. Unhappy with this, I bought another hard drive the same model as the second, and I am trying to move over to it without breaking the RAID 0 and losing everything.

I found a program that advertised its capability of backing up the whole hard drive or a partition thereof to one of four formats, among which is .vmdk. I told it to back up the usable partition that the fake RAID says exists, and the .vmdk successfully boots in VirtualBox. I have been doing this repeatedly for months, and only recently did I ever actually think to find out what the VM sees as its hard drive. It seems that when I told the program to back up the partition used (i.e. the actual hard drive), the program compelled itself to back up the entire hard drive, i.e. the whole RAID array.

This could have been fine and dandy, except that the entirety of the whole RAID array is a little more than .2 TiB greater than the capacity of the third hard drive. Since most of this is unused, I'm trying to cut it off, at which point I can migrate it to the third hard drive and then redo the RAID.

I'm using an Ubuntu live CD to do operations on the backup drive. I have converted the backup from .vmdk to .vdi (both disks boot properly in VirtualBox), I have converted it to raw and attempted to dd it to the new drive (reported that it ran out of space, and disk refused to boot).

VBoxManage is no help at reducing size, and I found somewhere that it is impossible. It seems that the only size I can reduce is the size that the host sees, which is problematic as the whole problem is cutting the logical size of the drive.

How exactly can I make the logical drive fit into 1 TB?

6
  • Use any too except vboxmanage since it can't shrink vbox vms
    – Ramhound
    Commented Jun 2, 2015 at 21:06
  • @Ramhound I'm pretty sure it can. I'm confused what the kelario wants though. Can you specify exactly what you have and exactly what you want to have at the end?
    – PythonNut
    Commented Jun 2, 2015 at 21:46
  • @PythonNut - Have you tried to do so, if you did, you would be aware the message it literally says the feature isn't implemented
    – Ramhound
    Commented Jun 2, 2015 at 22:07
  • @PythonNut I forget what it actually said, but it wasn't the "This feature isn't implemented yet" message. I found another post later though that --resize XXXXX is in megabytes, not bytes. I tried putting it in megabytes this time and it still says 0%, so maybe it's working now and it's just taking its time. I'm gonna leave it overnight.
    – kelario
    Commented Jun 3, 2015 at 1:08
  • @Ramhound Pardon me, but just because your solution doesn't work doesn't mean mine doesn't. Shrink the partitions on the disk, zero fill the empty space and compact. Or, you can shrink the partitions, write it out to an IMG with clonehd --format raw, truncate it, and convertfromraw. Failing that, you could swap out the clone and convert commands for dds from live media.
    – PythonNut
    Commented Jun 3, 2015 at 1:52

1 Answer 1

1

I started a thread at the VirtualBox forum, where I was told to create a new virtual drive of the desired smaller size and clone onto that one:

vboxmanage clonehd /path/to/old /path/to/new --existing

This was a success, and my virtual drive boots properly under VirtualBox. Not so much on the physical drive, where I get a winload.exe error, but virtual drive now fits on the physical drive.

2
  • Worked, but only reduced it from 33GB to 27GB. $ vboxmanage clonehd centos-7-1-1.x86_64.vmdk centos-7-1-1.x86_64_two.vdi --existing 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone medium created in format 'VDI'. UUID: 6a47f950-c364-498c-b680-4dbd815b9f8b
    – Chloe
    Commented Mar 26, 2018 at 17:22
  • It didn't work. The VM failed to boot and locked up. :( Wish I could retract the point.
    – Chloe
    Commented Mar 26, 2018 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .