Search code examples
azurevhd

azure VHD 1TB uploading


We have very slow connection and very small hard disk, How can I create 1 TB VHD for cloud drive on azure?


Solution

  • Do you need to upload an existing VHD or you just need a 1 TB Azure drive for your application in the cloud? If it is former, Rinat is probably right. Look at this blog post for how to write a console app: blogs.msdn.com/b/windowsazurestorage/archive/2010/04/11/using-windows-azure-page-blobs-and-how-to-efficiently-upload-and-download-page-blobs.aspx.

    However if you just need 1 TB Azure drive for your application, you can just create one using your code running in the cloud. You can write code similar to what I have written below:

    string pageBlobName = "testpageblob";// Guid.NewGuid().ToString();
    
    string blobUri = string.Format("{0}/{1}", blobContainer.Uri.AbsoluteUri, 
        pageBlobName);
    
    CloudDrive cloudDrive = new CloudDrive(new Uri(blobUri), csa.Credentials);
    
    for (int i = 0; i < 30; i++)
    {
        try
        {
            cloudDrive.Create(20);
    
            break;
        }
        catch (CloudDriveException ex)
        {
    
            if (!ex.Message.Equals("ERROR_UNSUPPORTED_OS") || i == 29)
                throw;
    
            Thread.Sleep(10000);
        }
    }
    
    
    string driveLetter = cloudDrive.Mount(25, DriveMountOptions.Force);