We have very slow connection and very small hard disk, How can I create 1 TB VHD for cloud drive on azure?
-
Can you better define the problem you are looking to solve? – Taylor Bird Jan 28 '11 at 15:24
5 Answers
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);

- 10,279
- 7
- 48
- 63

- 128,066
- 12
- 206
- 241
-
Thank you Gaurav and Rinat. Gaurav your second approach is what we need. As we have very small initial data to put on VHD, so we will create the VHD then put the data on VHD using RDP. – Anees Haider Feb 04 '11 at 16:04
-
I'm not sure if you can put the data into this VHD using RDP (I may be completely wrong here as I have not tried it) but apparently a page blob is mounted as a VHD by your code running in Azure. It would be really neat if you could do that. Other option for you to either push these files separately in blob storage (as block blobs) and then read them through your code or package your data files along with your deployment and have your code read these data files. – Gaurav Mantri Feb 05 '11 at 20:52
CSUpload does exactly that: uploads nonzero pages only.
You can create locally a (small) 1TB dynamic VHD and then upload with CSUpload (expanding to fixed size on-the-fly, without sending zero bytes). See also this question about having an 1TB disk in Azure.
you can also create a vm-disk and attach an vm to it and prepare it from there
then afterwards remove the disk from the vm(this will not remove it from storage) and mount it with cloudDrive
(you can delete the vm afterwards)

- 911
- 9
- 17
1TB is a extremely large size for vhd, however a brand new vhd only contain very little data(512 bytes for fixed hard disk image) at the end of file. In other words, the most data of your vhd is zero and there is no need to upload the entire 1TB data to azure storage.
For vhd file format, please refer to http://en.wikipedia.org/wiki/VHD_(file_format)
If you are familiar with vhd and azure storage client, you can write your own application to do these things.
Create an empty 1TB page blob on azure storage with PutBlob operation
http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
Write the VHD footer to end of the Page Blob with PutPage operation
http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
If not, you can use diskmgmt.msc(Disk Management) to create a vhd at first, and then use Set-AzureStorageBlobContent in windows azure powershell to efficiently upload your vhd. Set-AzureStorageBlobContent will skip the useless data when uploading page blob.
Set-AzureStorageBlobContent -Container upload -File .\a.vhd -BlobType Page
For reference, http://msdn.microsoft.com/en-us/library/dn408487.aspx

- 271
- 3
- 4
For efficient uploads you can write a simple console app that will upload your VHD to Azure Blob Storage as page blobs, transferring only non-zero bytes.

- 23,036
- 8
- 57
- 80