Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert exist Block Blob to PageBlob

Tags:

azure

I used the CloudBerry explorer to copy the VM(Iaas) disk file to a another Storage. But when I finished duplication, I found the new create Blob is a Block Blob, not a Page Blob. The tool didn't duplicate the source blob type which is Page Blob. Is there anyway to Convert to Page Blob from Block Blob? Thanks

like image 891
Joe.wang Avatar asked Oct 12 '12 03:10

Joe.wang


People also ask

How do you change a block blob to a page blob?

You need 2 SAS URLs with addecuate permission to read from the original container and to write to the destination. You also need the LIST permission. Having that, open the Cloud Shell and write the command. After coping, just delete the old page blobs.

How do I open a block blob file?

View a blob container's contents Open Storage Explorer. In the left pane, expand the storage account containing the blob container you wish to view. Expand the storage account's Blob Containers. Right-click the blob container you wish to view, and - from the context menu - select Open Blob Container Editor.

Would it be possible to modify an existing blob snapshot?

After you create a snapshot, you can read, copy, or delete it, but you cannot modify it.

What is the difference between blob storage and block blob storage?

Block blobs can store up to about 190.7 TiB. Append blobs are made up of blocks like block blobs, but are optimized for append operations. Append blobs are ideal for scenarios such as logging data from virtual machines. Page blobs store random access files up to 8 TiB in size.


2 Answers

No. Once a blob is created/uploaded you can't change the blob type. Unfortunately you would need to recreate/re-upload the blob. However I'm somewhat surprised. You mentioned that you copied the blob from one storage account to another. Copy Blob operation within Windows Azure (i.e. from one storage account to another) preserves the source blob type. It may seem a bug in CloudBerry explorer. I wrote a blog post some days ago about moving virtual machines from one subscription to another (http://gauravmantri.com/2012/07/04/how-to-move-windows-azure-virtual-machines-from-one-subscription-to-another/) and it has some sample code and other useful information for copying blobs across storage account. You may want to take a look at that. HTH.

like image 118
Gaurav Mantri Avatar answered Oct 02 '22 17:10

Gaurav Mantri


Has been a while since the original question, but it seems that the solution I used is not known or at least is not being used.

In Azure Storage you can not change the blob type for an existing file. Some people recommends download the files and upload again. But you can also use azcopy from the Cloud Shell in the Azure portal. At least in PowerShell the azcopy utility is available. I haven't tried in bash.

You need 2 SAS URLs with addecuate permission to read from the original container and to write to the destination. You also need the LIST permission. Having that, open the Cloud Shell and write the command.

azcopy copy 'https://<source-storage-account-name>.blob.core.windows.net/<source-container-name>?<SAS-token>' 'https://<dest-storage-account-name>.blob.core.windows.net/<dest-container-name>?<SAS-token>' --recursive --blob-type=BlockBlob

After coping, just delete the old page blobs.

More options for azcopy copy command can be found in the documentation.

This is the sample output:

sample output of the azcopy copy command in Cloud Shell

like image 25
Federico de los Santos Avatar answered Oct 02 '22 16:10

Federico de los Santos