Skip to main content

Choosing Between LRS, ZRS, and GRS Replication

Learn to choose between LRS, ZRS, GRS, and GZRS storage replication in Azure based on the actual disaster recovery requirement.

Overview and What You Will Learn

Azure Storage replication decides how many copies of your data exist and how far apart they sit, so the right option is the one that survives the failure you actually need to survive. In this lab you will create LRS, ZRS and GRS storage accounts, compare them, check geo-replication status, and upgrade an account to read-access geo-redundant storage.

  • Matching LRS, ZRS, GRS and GZRS to disk, datacenter and region failures
  • Creating storage accounts with each replication option
  • Finding a GRS account's paired secondary region
  • Reading the last sync time to understand potential data loss
  • Upgrading an existing account's replication

Why This Matters in Production

Assuming data is safe because it is "in the cloud" without checking its replication option is a common and costly mistake. Imagine a payments team at a company like Shopify whose storage account uses locally redundant storage (LRS). All three copies live in one datacenter, so if that datacenter becomes unavailable, every copy becomes unavailable at once.

Core Principles

Replication options differ in where the copies live. LRS keeps three copies inside one datacenter, ZRS spreads three copies across separate availability zones in one region, and GRS adds a second set of copies in a paired region hundreds of miles away. GZRS combines both, using ZRS in the primary region plus a copy in the secondary region.

flowchart TD Q1{Must survive a
regional outage?}:::q -->|yes| Q2{Also survive a
zone outage?}:::q Q2 -->|yes| GZRS[(GZRS)]:::warn Q2 -->|no| GRS[(GRS)]:::tool Q1 -->|no| Q3{Must survive a
zone outage?}:::q Q3 -->|yes| ZRS[(ZRS)]:::tool Q3 -->|no| LRS[(LRS)]:::soft classDef q fill:#FFEDD5,color:#1E293B classDef warn fill:#8B5CF6,color:#FFFFFF classDef tool fill:#326CE5,color:#FFFFFF classDef soft fill:#F1F5F9,color:#1E293B
Option Copies and location Survives
LRS 3 copies, one datacenter Disk and rack failure
ZRS 3 copies, 3 zones in one region Datacenter or zone loss
GRS LRS in primary plus 3 copies in the paired region Whole-region loss
GZRS ZRS in primary plus a copy in the paired region Zone loss and region loss

Replication to the secondary region is asynchronous, so the most recent writes may not have copied yet when a disaster hits. The read-access variants, RA-GRS and RA-GZRS, also let you read from the secondary copy while the primary is healthy, which suits read scaling and gives you a way to check the copy before you ever need it.

Detailed Step-by-Step Practical Lab

  1. Create a resource group:
Bash
az group create --name rg-replication-lab-central --location centralindia
  1. Create three storage accounts, one per replication option. Storage account names must be globally unique, so add a random suffix:
Bash
SUFFIX=$RANDOM
az storage account create \
--name streplicationlrs$SUFFIX \
--resource-group rg-replication-lab-central \
--location centralindia \
--sku Standard_LRS
az storage account create \
--name streplicationzrs$SUFFIX \
--resource-group rg-replication-lab-central \
--location centralindia \
--sku Standard_ZRS
az storage account create \
--name streplicationgrs$SUFFIX \
--resource-group rg-replication-lab-central \
--location centralindia \
--sku Standard_GRS
  1. Compare the three accounts side by side. Only the GRS account has a secondary location:
Bash
az storage account list \
--resource-group rg-replication-lab-central \
--query "[].[name,sku.name,secondaryLocation]" --output table
  1. Look at the paired secondary region. Azure chooses it for you based on the primary region, so you cannot pick a different one:
Bash
az storage account show \
--name streplicationgrs$SUFFIX \
--resource-group rg-replication-lab-central \
--query "secondaryLocation" --output tsv
  1. Check geo-replication status and the last sync time. Anything written after the last sync time could be lost in a failover. A new account can take a while before it reports a sync time:
Bash
az storage account show \
--name streplicationgrs$SUFFIX \
--resource-group rg-replication-lab-central \
--expand geoReplicationStats \
--query "geoReplicationStats" --output yaml
  1. Upgrade the LRS account to read-access geo-redundant storage. Moving from LRS to GRS or RA-GRS is a direct update, and Azure then copies the existing data to the secondary region in the background:
Bash
az storage account update \
--name streplicationlrs$SUFFIX \
--resource-group rg-replication-lab-central \
--sku Standard_RAGRS
az storage account show \
--name streplicationlrs$SUFFIX \
--resource-group rg-replication-lab-central \
--query "[sku.name,secondaryLocation,secondaryEndpoints.blob]" --output tsv
# Expected: Standard_RAGRS, southindia, and a -secondary blob endpoint
  1. Know the failover command, but do not run it in this lab. A customer-managed failover promotes the secondary region to primary, can lose writes made after the last sync time, and leaves the account as LRS in its new region:
Bash
# For reference only: use during a real regional outage
az storage account failover \
--name streplicationgrs$SUFFIX \
--resource-group rg-replication-lab-central
  1. Clean up:
Bash
az group delete --name rg-replication-lab-central --yes --no-wait

Production Best Practices & Common Pitfalls

Common Mistake

Treating replication as a backup. Every replication option copies deletes and corruption as faithfully as good data, so an accidental deletion disappears from every copy. Turn on blob soft delete, versioning and point-in-time restore as well.

Tip

Choose replication from the failure you need to survive, not by picking the most expensive option to be safe. Easily regenerated data may only need LRS, and critical financial records likely need GZRS or GRS.

Remember

ZRS does not protect against a regional outage, and plain GRS does not let you read the secondary copy until a failover happens. If you need to read the secondary, choose RA-GRS or RA-GZRS.

  • Treat GRS replication as asynchronous. In a regional failure, the newest writes may not have replicated, so GRS protects against total loss, not against losing the last moments before the disaster.
  • Check the last sync time. It tells you your real recovery point, so alert on it if your business has a recovery point target.
  • Plan failover in advance. After failover the account becomes LRS in the new primary region, so you must reconfigure geo-redundancy afterward, and some account features limit whether failover is available.
  • Remember the cost. GRS stores roughly twice the data of LRS, so apply it to the accounts that need it rather than every account by default.
  • Prefer GZRS for critical data in zone-enabled regions. It survives both a zone failure and a regional disaster without a failover for the zone case.

Quick Reference & Troubleshooting Commands

Command Description
az storage account create --sku Standard_LRS Create an account with local-only replication
az storage account create --sku Standard_ZRS Create an account replicated across zones in a region
az storage account create --sku Standard_GRS Create an account replicated to a secondary region
az storage account update --sku Standard_RAGRS Change an existing account's replication option
az storage account show --expand geoReplicationStats Check geo-replication status and last sync time
az storage account failover Fail over to the secondary region in a real outage

Explore More in Azure Storage Solutions

All 6 Topics

Frequently Asked Questions

Is Choosing Between LRS, ZRS, and GRS Replication free to learn on DevOps Network?

Yes - this topic, like everything on DevOps Network, is 100% free with no paywall or sign-up gate.

What does the Choosing Between LRS, ZRS, and GRS Replication topic cover?

Learn to choose between LRS, ZRS, GRS, and GZRS storage replication in Azure based on the actual disaster recovery requirement.

Found a mistake, an outdated step or a broken link?