Calculate the size/capacity of storage account and it services (Blob/Table)
Published Dec 12 2019 09:33 PM 107K Views
Microsoft

1. Calculate the capacity of all the storage account at the subscription level – via Portal .

  

   To view the utilization and availability of your storage accounts across all of your subscriptions, perform the following steps.

  1. Sign in to the Azure portal.
  2. Select Monitor from the left-hand pane in the Azure portal, and
  3. Under the Insights section, select Storage Accounts (preview).

clipboard_image_0.png

    IV. Select “Capacity

 

clipboard_image_1.png

               For more details, please visit here  :  https://docs.microsoft.com/en-us/azure/azure-monitor/insights/storage-insights-overview#view-from-az...

 

2. Calculate the capacity at the single storage account and different service level (Blob/Queue/Table/File) – via Portal.

  1. In the Azure portal, select Storage accounts.
  2. From the list, choose a storage account.
  3. In the Monitoring section, choose Insights (preview).

clipboard_image_2.png

iv. Select the Capacity

clipboard_image_3.png

 

For more details , please visit here :  https://docs.microsoft.com/en-us/azure/azure-monitor/insights/storage-insights-overview#view-from-a-...

 

3. Calculate the size of a Blob storage container – via PowerShell

 

This script calculates the size of a container in Azure Blob storage by totaling the size of the blobs in the container.

 

For more details , please visit here :  https://docs.microsoft.com/en-us/azure/storage/scripts/storage-blobs-container-calculate-size-powers...

Script that calculates container size for billing purposes, see Calculate the size of a Blob storage container for billing purposes

 

4. Calculate the size of a Blob storage container - via Azure CLI

This script calculates the size of a container in Azure Blob storage by totaling the size of the blobs in the container.

https://docs.microsoft.com/en-us/azure/storage/scripts/storage-blobs-container-calculate-size-cli#sa...

 

5. Calculate the size of a Blob storage container – via Storage explorer

 

  1. Sign-in to azure storage explorer using any of the approach mentioned here  - https://docs.microsoft.com/en-us/azure/vs-azure-tools-storage-manage-with-storage-explorer?tabs=wind...
  2. Select the storage of your interest.
  3. Select the container.
  4. Click “Folder Statistics” button.

clipboard_image_4.png

 

6. Calculate Table storage entity count – via Storage explorer

  1. Sign-in to azure storage explorer using any of the approach mentioned here  - https://docs.microsoft.com/en-us/azure/vs-azure-tools-storage-manage-with-storage-explorer?tabs=wind...
  2. Select the storage of your interest.
  3. Select the Table.
  4. Click “Table Statistics”.

clipboard_image_5.png

 

7. Calculate Table storage entity count – via PowerShell

 

$connectionString = "Connection String of your storage account"

$context = New-AzureStorageContext -ConnectionString $connectionString

$azureStorageTable = Get-AzureStorageTable -Context $context

 

 

function GetTableCount($table)

{

    #Create a table query.

    $query = New-Object Microsoft.WindowsAzure.Storage.Table.TableQuery

 

 

 

    #Define columns to select.

    $list = New-Object System.Collections.Generic.List[string]

    $list.Add("PartitionKey")

 

 

 

    #Set query details.

    $query.SelectColumns = $list

 

 

 

    #Execute the query.

    $entities = $table.CloudTable.ExecuteQuery($query)

    ($entities | measure).Count

}

 

foreach ($table in $azureStorageTable)

{

   

"Table name :"+ $table.Name 

GetTableCount $table

 

}

"Total number of tables : " + $azureStorageTable.Count

 

8. Calculate the size of each entity in azure storage table.

 

The following expressions shows how to estimate the amount of storage consumed per entity:

Total Entity Size:

  • 4 bytes + Len (PartitionKey + RowKey) * 2 bytes + For-Each Property(8 bytes + Len(Property Name) * 2 bytes + Sizeof(.Net Property Type))

 

The following is the breakdown:

  • 4 bytes overhead for each entity, which includes the Timestamp, along with some system metadata.
  • The number of characters in the PartitionKey and RowKey values, which are stored as Unicode (times 2 bytes).
  • Then for each property we have an 8 byte overhead, plus the name of the property * 2 bytes, plus the size of the property type as derived from the list below.

 The Sizeof(.Net Property Type) for the different types is:

  • String – # of Characters * 2 bytes + 4 bytes for length of string
  • DateTime – 8 bytes
  • GUID – 16 bytes
  • Double – 8 bytes
  • Int – 4 bytes
  • INT64 – 8 bytes
  • Bool – 1 byte
  • Binary – sizeof(value) in bytes + 4 bytes for length of binary array

Note:

  1. We do not have inbuilt feature to calculate the size of individual table, to do that you would need to write your own script to calculate the size of individual entity i.e.  Size of storage table = Sum of all the individual entity in given storage table.  (Any type of operation against the storage is counted as a transaction, including reads, writes and deletes and hence it would be charged. For more details, please visit here  - https://azure.microsoft.com/en-in/pricing/details/storage/tables/ )
1 Comment
Version history
Last update:
‎Sep 17 2020 11:20 PM
Updated by: