Errors when compacting VirtualBox VHD Image












2















My host OS is OS X Lion running a Windows XP client with VirtualBox 4.2.0. I'm wanting to make a copy of the image and compact it to share with a colleague. First, I used the VirtualBox command line to clone the image via clonehd.



VBoxManage clonevdi /path/to/image.vhd /new/path/to/image.vhd


Next, I tried compacting the image with the following command:



VBoxManage modifyhd /new/path/to/image.vhd --compact


In which I'm presented with the following error:



Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Failed to compact hard disk
VBoxManage: error: Could not compact medium '/new/path/to/image.vhd' (VERR_INVALID_STATE)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium
VBoxManage: error: Context: "int handleModifyHardDisk(HandlerArg*)" at line 577 of file VBoxManageDisk.cpp


I've tried my hand at resolving the issue by searching, but I've came up empty handed up to this point. Any help will be greatly appreciated.










share|improve this question



























    2















    My host OS is OS X Lion running a Windows XP client with VirtualBox 4.2.0. I'm wanting to make a copy of the image and compact it to share with a colleague. First, I used the VirtualBox command line to clone the image via clonehd.



    VBoxManage clonevdi /path/to/image.vhd /new/path/to/image.vhd


    Next, I tried compacting the image with the following command:



    VBoxManage modifyhd /new/path/to/image.vhd --compact


    In which I'm presented with the following error:



    Progress state: VBOX_E_FILE_ERROR
    VBoxManage: error: Failed to compact hard disk
    VBoxManage: error: Could not compact medium '/new/path/to/image.vhd' (VERR_INVALID_STATE)
    VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium
    VBoxManage: error: Context: "int handleModifyHardDisk(HandlerArg*)" at line 577 of file VBoxManageDisk.cpp


    I've tried my hand at resolving the issue by searching, but I've came up empty handed up to this point. Any help will be greatly appreciated.










    share|improve this question

























      2












      2








      2








      My host OS is OS X Lion running a Windows XP client with VirtualBox 4.2.0. I'm wanting to make a copy of the image and compact it to share with a colleague. First, I used the VirtualBox command line to clone the image via clonehd.



      VBoxManage clonevdi /path/to/image.vhd /new/path/to/image.vhd


      Next, I tried compacting the image with the following command:



      VBoxManage modifyhd /new/path/to/image.vhd --compact


      In which I'm presented with the following error:



      Progress state: VBOX_E_FILE_ERROR
      VBoxManage: error: Failed to compact hard disk
      VBoxManage: error: Could not compact medium '/new/path/to/image.vhd' (VERR_INVALID_STATE)
      VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium
      VBoxManage: error: Context: "int handleModifyHardDisk(HandlerArg*)" at line 577 of file VBoxManageDisk.cpp


      I've tried my hand at resolving the issue by searching, but I've came up empty handed up to this point. Any help will be greatly appreciated.










      share|improve this question














      My host OS is OS X Lion running a Windows XP client with VirtualBox 4.2.0. I'm wanting to make a copy of the image and compact it to share with a colleague. First, I used the VirtualBox command line to clone the image via clonehd.



      VBoxManage clonevdi /path/to/image.vhd /new/path/to/image.vhd


      Next, I tried compacting the image with the following command:



      VBoxManage modifyhd /new/path/to/image.vhd --compact


      In which I'm presented with the following error:



      Progress state: VBOX_E_FILE_ERROR
      VBoxManage: error: Failed to compact hard disk
      VBoxManage: error: Could not compact medium '/new/path/to/image.vhd' (VERR_INVALID_STATE)
      VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium
      VBoxManage: error: Context: "int handleModifyHardDisk(HandlerArg*)" at line 577 of file VBoxManageDisk.cpp


      I've tried my hand at resolving the issue by searching, but I've came up empty handed up to this point. Any help will be greatly appreciated.







      virtualbox






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 25 '13 at 17:22









      naivedevelopernaivedeveloper

      13019




      13019






















          2 Answers
          2






          active

          oldest

          votes


















          2














          You can only compact VDI images using the VirtualBox commandline as far as I know. You can use 3rd party tools to compact a VHD - Google is your friend.



          If your host is Windows 7 or Windows Server 2008 R2, you should be able to use compact vdisk according to the page at technet.microsoft.com/en-us/library/gg252556.aspx.



          In the VirtualBox world, here's how...



          VBoxManage modifyhd pathtodisk.VDI --compact


          ...if you've created a disk in a different format - e.g. VHD, exec the following command first...



          VBoxManage clonehd "pathtovhdformat.vhd" "pathtovdiformat.vdi" --format vdi


          See this example..., as well as this comprehensive example by Matt Wrock on how to optimise a VirtualBox VM, ready for packaging.






          share|improve this answer





















          • 1





            I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

            – evilpenguin
            Jul 20 '17 at 10:47



















          0














          Same happened to me just now but I quickly fixed it by just shutting down the virtual machine.



          -Looks like you can't shrink virtualbox storage while it's in use.






          share|improve this answer
























          • I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

            – Scott
            Jan 12 at 22:01











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f599905%2ferrors-when-compacting-virtualbox-vhd-image%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You can only compact VDI images using the VirtualBox commandline as far as I know. You can use 3rd party tools to compact a VHD - Google is your friend.



          If your host is Windows 7 or Windows Server 2008 R2, you should be able to use compact vdisk according to the page at technet.microsoft.com/en-us/library/gg252556.aspx.



          In the VirtualBox world, here's how...



          VBoxManage modifyhd pathtodisk.VDI --compact


          ...if you've created a disk in a different format - e.g. VHD, exec the following command first...



          VBoxManage clonehd "pathtovhdformat.vhd" "pathtovdiformat.vdi" --format vdi


          See this example..., as well as this comprehensive example by Matt Wrock on how to optimise a VirtualBox VM, ready for packaging.






          share|improve this answer





















          • 1





            I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

            – evilpenguin
            Jul 20 '17 at 10:47
















          2














          You can only compact VDI images using the VirtualBox commandline as far as I know. You can use 3rd party tools to compact a VHD - Google is your friend.



          If your host is Windows 7 or Windows Server 2008 R2, you should be able to use compact vdisk according to the page at technet.microsoft.com/en-us/library/gg252556.aspx.



          In the VirtualBox world, here's how...



          VBoxManage modifyhd pathtodisk.VDI --compact


          ...if you've created a disk in a different format - e.g. VHD, exec the following command first...



          VBoxManage clonehd "pathtovhdformat.vhd" "pathtovdiformat.vdi" --format vdi


          See this example..., as well as this comprehensive example by Matt Wrock on how to optimise a VirtualBox VM, ready for packaging.






          share|improve this answer





















          • 1





            I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

            – evilpenguin
            Jul 20 '17 at 10:47














          2












          2








          2







          You can only compact VDI images using the VirtualBox commandline as far as I know. You can use 3rd party tools to compact a VHD - Google is your friend.



          If your host is Windows 7 or Windows Server 2008 R2, you should be able to use compact vdisk according to the page at technet.microsoft.com/en-us/library/gg252556.aspx.



          In the VirtualBox world, here's how...



          VBoxManage modifyhd pathtodisk.VDI --compact


          ...if you've created a disk in a different format - e.g. VHD, exec the following command first...



          VBoxManage clonehd "pathtovhdformat.vhd" "pathtovdiformat.vdi" --format vdi


          See this example..., as well as this comprehensive example by Matt Wrock on how to optimise a VirtualBox VM, ready for packaging.






          share|improve this answer















          You can only compact VDI images using the VirtualBox commandline as far as I know. You can use 3rd party tools to compact a VHD - Google is your friend.



          If your host is Windows 7 or Windows Server 2008 R2, you should be able to use compact vdisk according to the page at technet.microsoft.com/en-us/library/gg252556.aspx.



          In the VirtualBox world, here's how...



          VBoxManage modifyhd pathtodisk.VDI --compact


          ...if you've created a disk in a different format - e.g. VHD, exec the following command first...



          VBoxManage clonehd "pathtovhdformat.vhd" "pathtovdiformat.vdi" --format vdi


          See this example..., as well as this comprehensive example by Matt Wrock on how to optimise a VirtualBox VM, ready for packaging.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 26 '15 at 2:08









          Eric G

          940521




          940521










          answered Feb 26 '15 at 1:27









          TechSpudTechSpud

          213




          213








          • 1





            I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

            – evilpenguin
            Jul 20 '17 at 10:47














          • 1





            I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

            – evilpenguin
            Jul 20 '17 at 10:47








          1




          1





          I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

          – evilpenguin
          Jul 20 '17 at 10:47





          I have noticed that when converting from VHD to VDI, the result is already optimized, so you don't have to run --compact on it again.

          – evilpenguin
          Jul 20 '17 at 10:47













          0














          Same happened to me just now but I quickly fixed it by just shutting down the virtual machine.



          -Looks like you can't shrink virtualbox storage while it's in use.






          share|improve this answer
























          • I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

            – Scott
            Jan 12 at 22:01
















          0














          Same happened to me just now but I quickly fixed it by just shutting down the virtual machine.



          -Looks like you can't shrink virtualbox storage while it's in use.






          share|improve this answer
























          • I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

            – Scott
            Jan 12 at 22:01














          0












          0








          0







          Same happened to me just now but I quickly fixed it by just shutting down the virtual machine.



          -Looks like you can't shrink virtualbox storage while it's in use.






          share|improve this answer













          Same happened to me just now but I quickly fixed it by just shutting down the virtual machine.



          -Looks like you can't shrink virtualbox storage while it's in use.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 12 at 21:22









          gamingradeongamingradeon

          1




          1













          • I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

            – Scott
            Jan 12 at 22:01



















          • I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

            – Scott
            Jan 12 at 22:01

















          I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

          – Scott
          Jan 12 at 22:01





          I'm not sure that this is relevant to this question, since the image that the OP was trying to compact was already a clone/copy of an existing VM.

          – Scott
          Jan 12 at 22:01


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f599905%2ferrors-when-compacting-virtualbox-vhd-image%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

           ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕