Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Page Blob obligates me to tamper the file size

I'm trying to create a Page Blob, because I would need random access in the future, although I can upload the file, when I download it the size is different.

I get "file.docx" uploaded, and then downloaded as "file2.docx". The downloaded one is a little bigger, actually its size is rounded to page blob page size, 512 :) In this particular case, Microsoft Word gives me a warning saying the file is corrupt, but I can still open it and the content is what I was expecting.

I got the code example from here: Using Windows Azure Page Blobs and How to Efficiently Upload and Download Page Blobs. I've checked out the code to upload it and the documentation, and apparently your page upload must start on a 512 byte boundary (startingOffset % 512 == 0), and end on a 512 boundary - 1. Then what does happen when I need to upload a file that is not aligned to 512?

For example, if I have a file with 550bytes and I upload it and download it I'll get a file with 1024 bytes, right? What should I do? keep the original file size in the metadata or there is a way to do it right?(or example).

Thanks in advance.

like image 266
vtortola Avatar asked Apr 18 '11 13:04

vtortola


People also ask

Which is the page size for an Azure Page blob?

Page blobs are made up of 512-byte pages up to 8 TB in total size and are designed for frequent random read/write operations. Page blobs are the foundation of Azure IaaS Disks.

What is the difference between block blob vs page blob?

They are named block blobs because files larger than 100 MB must be uploaded as small blocks, which are then consolidated (or committed) into the final blob. Page blobs are used to hold random-access files up to 8 TB in size.

What is the difference between blob and file storage in Azure?

In summary, the difference between the two storage services is that Azure Blob Storage is a store for objects capable of storing large amounts of unstructured data. On the other hand, Azure File Storage is a distributed, cloud-based file system.

Which type of storage blob is best for random access files?

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.


1 Answers

Yes, you should "keep the original file size in the metadata". Or consider using block blobs.

like image 190
Jason Cooke -Microsoft Avatar answered Sep 18 '22 12:09

Jason Cooke -Microsoft