locked
Resize a Page Blob RRS feed

  • Question

  • Hi,

    Is there a way of resizing a page blob or copy it to a smaller one?

    I've tried to copy page blob A to page blob B, where B is smaller than A, but after execute copyTo, B is as big as A.

    Also, what could be the problem if I declare all the page blobs as 1TB? As far as I know, I would only pay for the pages I use, so if the 99% of the page blob is empty it wouldn't be a problem. But I'd like to be sure.

    Cheers.

     


    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Monday, April 18, 2011 8:58 PM

Answers

All replies

  • -- Is there a way of resizing a page blob or copy it to a smaller one?

    No, there is no storage operation that does that for you - although you can obviously do it yourself.

    UPDATE: This is wrong. See Gaurav Mantri's answr below

    Monday, April 18, 2011 9:21 PM
    Answerer
  • -- Is there a way of resizing a page blob or copy it to a smaller one?

    No, there is no storage operation that does that for you - although you can obviously do it yourself.

    I guess I could create a new one with the new size and copy it manually, but for large files it would be a pain.

    Thanks.


    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Monday, April 18, 2011 9:33 PM
  • Actually there is a way to resize a page blob. Please look at REST API documentation of setting blob properties: http://msdn.microsoft.com/en-us/library/ee691966.aspx. Please look under Request Headers (Page Blobs Only) section where you can specify new page blob size by definining new size in "x-ms-blob-content-length" request header. 

    You can find the complete sample here: http://blogs.msdn.com/b/windowsazurestorage/archive/2010/04/11/using-windows-azure-page-blobs-and-how-to-efficiently-upload-and-download-page-blobs.aspx (look under Advanced Functionality – Clearing Pages and Changing Page Blob Size section)

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

    • Marked as answer by vtortola Tuesday, April 19, 2011 8:34 AM
    Tuesday, April 19, 2011 3:53 AM
  • Good catch, Gaurav. I obviously didn't look hard enough.
    Tuesday, April 19, 2011 4:12 AM
    Answerer
  • Fantastic, I will try to do that.

    Thanks a lot!


    .: Valeriano Tórtola MCTS WPF :.: http://www.vtortola.net :.
    Tuesday, April 19, 2011 8:34 AM