Epics@GSI Webhome

Tipps Windows Resize Raw Img File Using Virtual Box

Introduction

Following the recommendation on http://raspberrypi.stackexchange.com/questions/4943/resize-image-file-before-writing-to-sd-card:
  • e.g. to resize to 15.5GB, approx. size 15500
set VBOXMANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
IF NOT EXIST %VBOXMANAGE% (
   echo %VBOXMANAGE% does not exist ... exiting)
)
ELSE (
   IF EXIST input.vdi   ( %VBOXMANAGE% closemedium disk input.vdi --delete)
   IF EXIST output.vdi ( %VBOXMANAGE% closemedium disk output.vdi --delete) 
   IF EXIST output.img (%VBOXMANAGE% closemedium disk output.img)
    
   REM  use without .img
   set /p INPUT_NAME="Enter input file name without .img: "; 
   set OUTPUT_NAME=%INPUT_NAME%_resized 
   set /p OUTPUT_SIZE="Enter Size (MB) (e.g. 15000): "  
    
   ECHO "=========================================================================" 
   %VBOXMANAGE% convertfromraw %INPUT_NAME%.img input.vdi -format VDI --variant Standard 
   ECHO "=========================================================================" 
   %VBOXMANAGE% createhd --filename output.vdi --size %OUTPUT_SIZE% --format VDI --variant Standard 
   ECHO "=========================================================================" 
   %VBOXMANAGE% clonehd input.vdi output.vdi --existing 
   ECHO "=========================================================================" 
   %VBOXMANAGE% clonehd output.vdi output.img --format RAW 
   copy output.img %OUTPUT_NAME%.img 
   %VBOXMANAGE% closemedium disk input.vdi --delete 
   %VBOXMANAGE% closemedium disk output.vdi --delete 
   %VBOXMANAGE% closemedium disk output.img 
)


-- PeterZumbruch - 2019-01-10
-- PeterZumbruch - 2020-11-09
Topic revision: r7 - 2020-11-09, PeterZumbruch - This page was cached on 2021-10-16 - 23:03.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Imprint (german) | Privacy Policy (german)