OSClone with IndexOutOfRangeException

Aug 21, 2010 at 4:26 AM

Dear Sir/Madam,

I'd just downloaded and compile with VS2010. No matter I run the pre-compiled or re-compiled OSClone.exe, I got the following exception error, what did I do wrong?

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.   at DiscUtils.Vhd.DynamicStream.PopulateBlockBitmap(Int64 block) in C:\Users\Administrator.WIN2008-BSS3\Documents\diskutils2\src\Vhd\DynamicStream.cs:line 522

   at DiscUtils.Vhd.DynamicStream.Write(Byte[] buffer, Int32 offset, Int32 count) in C:\Users\Administrator.WIN2008-BSS3\Documents\diskutils2\src\Vhd\DynamicStream.cs:line 326   at DiscUtils.VirtualDisk.SetMasterBootRecord(Byte[] data) in C:\Users\Administrator.WIN2008-BSS3\Documents\diskutils2\src\VirtualDisk.cs:line 161   at OSClone.Program.DoRun() in C:\Users\Administrator.WIN2008-BSS3\Documents\diskutils2\utils\OSClone\Program.cs:line 81   at DiscUtils.Common.ProgramBase.Run(String[] args) in C:\Users\Administrator.WIN2008-BSS3\Documents\diskutils2\utils\DiscUtils.Common\ProgramBase.cs:line 218
   at OSClone.Program.Main(String[] args) in C:\Users\Administrator.WIN2008-BSS3\Documents\diskutils2\utils\OSClone\Program.cs:line 54


millions thanks.


Aug 21, 2010 at 1:37 PM


I suspect you haven't specified the -sz parameter on OSClone, so it's trying to create a 0-byte disk.

I've checked in some changes that add better checking, in the mean time this should work:

C:\> OSClone source.vhd dest.vhd -of VHD-dynamic -sz 10GB



Aug 21, 2010 at 2:20 PM

Thanks Ken. You are great!

thanks again.