Which PostgreSQL storage decisions matter before go-live
Storage choices affect durability, performance and recovery, and they are hard to change once data is in place. If you are about to build or move a PostgreSQL server, decide the disks and file system deliberately rather than accepting the installer's defaults. A deliberate decision is needed when you buy new hardware, move to a new platform, provision a cloud volume with IOPS caps, or when a restore test has failed and the cause is unclear. PostgreSQL does not manage the disk itself. It depends on the operating system and hardware to honor fsync requests and to write data in the order it was asked, so a storage stack that acknowledges writes early can lose committed transactions after a power failure even though PostgreSQL behaved correctly.
The PostgreSQL documentation asks you to plan around two components: the data directory, which holds the table and index files, and the write-ahead log (WAL), which records changes before they reach the data files and drives crash recovery and point-in-time recovery. Both sit on storage you choose, so the questions are concrete. Does the controller have a battery or flash-backed write cache, and is it enabled only when that protection is working? Will WAL share a device with data, or will it get its own volume so that a burst of table writes cannot starve commit latency? Which file system will you use, and does it support data checksums end to end? Write these answers down before installation, because they determine what your backup and restore tests can prove later. Confirm each point with your hardware vendor, your cloud provider's volume documentation, and the continuous archiving guidance for how WAL must be retained.
Ask your team or partner for a written list of these decisions, each with an owner and a verification step. Examples of verification include a power-loss test on a staging host, a measured fsync latency under load, and a timed restore from a backup taken on the chosen storage. The sections that follow compare file systems, separate WAL, check data checksums, and assess snapshots and cloud volume limits, so this section is the checklist that tells you which of those trade-offs apply to your environment.
Storage options and when each fits
This table compares the storage options most teams weigh for PostgreSQL data and WAL, from local disks to cloud volumes. Read each row for the fit, the main trade-off and the questions to put to your hardware, file system or cloud vendor before you commit, because the right answer depends on your durability, failover and recovery requirements.
| Option | Best fit | Main trade-off | Confirm with the vendor or your environment |
|---|---|---|---|
| Local NVMe or SSD with a battery or capacitor-backed write cache | Single primary or a replicated cluster where each node has its own disks and failover handles server loss | Data lives on one server, so node replacement depends on replicas and tested restores | Cache protection survives power loss, and the controller flushes cached writes to disk when the cache is enabled |
| Hardware RAID controller with write cache | Teams that already standardize on RAID hardware and want controller-managed redundancy | Write-back caching without protection can lose acknowledged writes after power failure | Battery or flash backup status, write-through fallback behavior, and whether disk-level flush commands reach the drives |
| XFS | Large data directories and common Linux distributions where PostgreSQL is widely deployed | Needs disciplined backup and snapshot handling, and filesystem tuning is a separate task | Mount options, barrier behavior on your kernel, and support status for your distribution release |
| ext4 | Conventional Linux installs with modest data volumes and familiar operations tooling | Filesystem growth and features are narrower than some alternatives for very large volumes | Journal mode, mount options and the behavior of your storage stack under power loss |
| ZFS | Teams that want checksumming, snapshots and compression in one layer and can run it operationally | Memory use, a separate tuning surface for datasets, and a different operations skill set | Supported OpenZFS version for your OS, dataset settings and how snapshots interact with backup tooling |
| Network block storage (SAN or iSCSI) | Shared infrastructure where the storage team owns redundancy and capacity | Latency and failover behavior depend on the network and the array, not only PostgreSQL settings | Write acknowledgment semantics, multipath configuration, latency under load and replication features of the array |
| Cloud block volumes | Teams running in a provider you already control, with snapshot and resize tooling in place | Throughput and IOPS are limited by volume type and size, and limits differ by provider | Baseline and burst IOPS, throughput caps, snapshot consistency guarantees and instance-level limits |
| Separate volume for WAL | Write-heavy clusters where WAL flushes should not compete with data file I/O | Adds another volume to provision, monitor, size and back up | Whether the chosen volume type meets sustained write latency for WAL, and how its snapshots are taken |
How write cache safety protects commits
PostgreSQL reports a transaction as committed only after the write-ahead log record for that commit has been flushed to storage that the operating system and drive say is durable. The reliability guidance in the PostgreSQL documentation, which covers WAL and the fsync and wal_sync_method settings, assumes that when a flush call returns, the data survives a power loss. That assumption is what makes a commit acknowledged to the application a promise. If the storage stack reports a flush as complete while the bytes still sit in a volatile cache, a power cut can erase commits the application already believes are saved, and PostgreSQL has no way to detect this from inside the database. Your storage design has to make the flush honest all the way down.
The usual failure points are a volatile write cache on a drive or controller with no protection, and a RAID controller that acknowledges writes from its own cache without a battery-backed or flash-backed module to hold them through an outage. Write-back caching can make a benchmark look excellent, which is why the risk often surfaces only after a real outage. Before go-live, ask the hardware vendor to confirm in writing whether each controller and drive honors flush requests, whether the cache is protected by a battery or flash module, and what happens to the cache during a power loss and when a module fails. Check the current state on the hardware you actually received, since firmware and cache policies can change after installation.
In cloud environments, the equivalent question goes to the provider. Ask whether the block volume type you chose guarantees durable writes once a flush returns, whether any write caching is performed by the hypervisor or host layer, and how the provider documents the durability and consistency of that volume type. Confirm whether the instance type or host has any ephemeral or local storage in the write path, because local instance storage is generally not intended to hold the only copy of data. Ask for the documentation that covers these points, not a verbal assurance. Your own verification should include a power-loss or forced-restart test on a non-production copy, followed by a check that every commit the application received an acknowledgment for is present afterward. Plan to repeat that check after firmware updates, controller replacements or changes to volume types.
Separating WAL from data files: when it helps and what it costs
Moving pg_wal to its own device is one of the few storage layout choices that changes failure behavior as well as speed. The cards below cover the decisions that connect placement, sizing, archiving and recovery, and the checks to make before you move anything.
Decide whether a separate device helps
A separate device for pg_wal helps when commit latency is limited by WAL writes and the data volume is busy with random reads and checkpoint writes. Each commit must flush WAL, so contention on a shared volume can slow every transaction. Measure WAL write latency and fsync time on the current layout before buying hardware. For a small or read-heavy database, a second device may add cost without a measurable gain. Ask the platform team what the workload's commit rate and checkpoint pattern look like.
WAL and archiving docsSize WAL for peak write volume
WAL volume grows with write rate, full-page writes after each checkpoint, and the number of retained segments. Retained WAL also grows when a replica falls behind, when a replication slot is inactive, or when archiving fails. Size the WAL volume for peak write activity plus the backlog you would tolerate during an archive or standby outage, and alert on free space well before it runs out. Your own load tests, not a generic rule, should set the number.
Keep archive destinations separate
WAL archives should not share a volume or failure domain with pg_wal. If archive storage fills or a mount fails, the server can run out of WAL segments to recycle and stop accepting writes. Point the archive command at a separate target, such as a backup host or object storage location, and monitor archive lag as its own signal. Confirm which copy your point-in-time recovery depends on and where it is stored.
Map the failure domains
Separate devices only reduce risk if they fail independently. Two volumes carved from the same disk shelf, RAID group, storage pool or cloud disk type share fate. Record which physical device, controller, host and network path serves each volume. A loss of the pg_wal device stops the primary, so the recovery plan must cover restoring WAL, rebuilding the standby, or failing over. Ask your storage team to show this mapping in writing.
Move pg_wal with a stopped server
Moving pg_wal safely means stopping PostgreSQL cleanly, copying the directory with its permissions and ownership intact, and replacing the original with a symbolic link to the new location. Verify the cluster starts, check the log for errors, and confirm new WAL files appear on the new device. Take a fresh base backup before the change so you can roll back. Test the sequence on a non-production copy first, and record each step in the change ticket.
High availability docsXFS, ext4 or ZFS: choosing the file system
On servers where your team already runs ext4 or XFS, the default choice is usually the one your operators know best. Both are journaling file systems in the mainline Linux kernel, both are widely supported by distribution tooling, and neither provides the copy-on-write snapshots or block-level checksumming that ZFS offers. PostgreSQL protects its own data pages with optional data checksums, which you enable at initdb time or later with offline tools, so the file system does not have to be the only integrity check. Key points to weigh:
- Journaling behavior: Both file systems journal metadata by default, which speeds recovery after a crash. Confirm the mount options your distribution sets and do not change them without testing.
- Snapshots: Snapshot support depends on the storage layer (LVM, SAN or hypervisor) rather than on the file system itself, so plan backups with PostgreSQL continuous archiving regardless.
- Checksumming: Neither file system checksums data blocks, so enable PostgreSQL data checksums and monitor for reported errors.
- Compression: Neither offers transparent compression for PostgreSQL data in the way ZFS does, so size storage for the uncompressed footprint.
- Operations fit: Ask whether your team can restore an XFS or ext4 volume and rehearse recovery on the same kernel and tooling used in production.
Confirm the file system, mount options and checksum setting in writing with your platform owner before the first load.
Teams that already run ZFS for file services, virtualization or backups have a different starting point. ZFS brings copy-on-write data handling, end-to-end checksums on data and metadata, built-in compression and dataset-level snapshots. Those features are useful for PostgreSQL, but they also change how writes behave and how backups are taken, so they need deliberate tuning. The detailed settings belong in the sibling page on running PostgreSQL on ZFS, so this tab covers the decision only:
- Checksumming: ZFS verifies checksums on every read and can repair from redundant copies, which complements PostgreSQL data checksums rather than replacing them.
- Snapshots: Dataset snapshots are fast to create, but a snapshot is only a useful backup when it is consistent with the database and the WAL needed to replay it.
- Compression: Built-in compression is available per dataset, and its benefit depends on your data and workload, so measure it on a copy of production data.
- Operations skill: Confirm that the team can manage pools, scrubs, resilver and dataset properties, since a misconfigured pool is harder to recover than a misconfigured ext4 volume.
- Memory: ZFS caches data in its own ARC, which competes with PostgreSQL's shared buffers and the OS cache. Size memory with both in mind.
Before committing, ask your storage team to show a tested restore from a ZFS snapshot plus archived WAL.
On cloud virtual machines, managed block volumes and Kubernetes, the choice of file system is often made for you by the image, the storage class or the CSI driver. The decisions that remain are the file system the platform formats, the volume type and the IOPS and throughput limits it enforces. Those limits are often the constraint that matters most, because a volume can run out of provisioned I/O before the file system does. Points to confirm with the provider or your platform team:
- Volume limits: Check the provisioned IOPS and throughput for both the data and WAL volumes, and whether bursts are throttled once credits run out.
- Format and mount: Confirm which file system the storage class formats and which mount options it applies, and whether the volume is reattached cleanly after node failure.
- Snapshots: Provider snapshots may be crash-consistent unless the database is quiesced, so pair them with PostgreSQL base backups and WAL archiving.
- Checksumming and encryption: Confirm what the provider checksums and encrypts at rest, and whether that meets your own control requirements.
- Container specifics: Kubernetes volume expansion, resize behavior and node affinity change how a failed pod recovers, so test them before production.
Request the provider's documented IOPS and throughput limits for each volume type you plan to use, and load test against them.
Data checksums and snapshots as backups
Data checksums must be decided before the cluster exists. PostgreSQL computes checksums on data pages when the cluster is initialized, typically through initdb with the --data-checksums option, and it cannot add them to a populated cluster later without a rebuild or a dump and restore. Checksums let PostgreSQL detect pages that were damaged at rest or in transit between the database and the disk, which otherwise can be read back silently as corrupted data. Confirm with your platform team that the option is part of the initialization script or automation, check the setting on existing clusters before relying on it, and remember that checksums detect damage but do not repair it. Repair still comes from a backup or a replica.
A storage snapshot is not a substitute for a tested backup unless PostgreSQL is coordinated with the snapshot and archived WAL is kept. A snapshot taken while the database is writing captures files that were never flushed in a consistent state, so restoring it can produce a cluster that fails to start or that starts with damage. Coordination means putting the database in backup mode with pg_backup_start and pg_backup_stop around the snapshot, or using a tool that does this for you, and archiving WAL continuously so the restore can reach a chosen point after the snapshot. The documented basis for restores is continuous archiving and point-in-time recovery, which combines a base backup with archived WAL files. Ask your storage vendor exactly what their snapshot API guarantees about write ordering across multiple volumes, and run a restore into a separate environment on a schedule to prove the result.
How data, WAL and backups sit on separate failure domains
The diagram starts at the PostgreSQL server, where the data directory and the WAL directory are written on separate volumes. WAL segments flow to an archive destination on the storage network, and a separate off-host copy takes the backups to a site outside the host's trust boundary. Check that a single disk, controller or storage array failure cannot remove the data, the WAL needed for point-in-time recovery and the copy that restores them, and confirm that each hand-off has its own access control and retention.
Data, WAL, archive and off-site copy as separate failure domains.
Cloud volume IOPS and throughput limits to plan around
Cloud block volumes rarely fail with a clear error when they run out of performance. They slow down, queue writes and stretch commit latency, which is why limits must be known before sizing a PostgreSQL data directory and WAL volume. The cards below cover the limits and costs to confirm with your provider and to test under realistic write load.
Provisioned IOPS caps
Many cloud volume types let you set or buy a number of IOPS, and the cap applies per volume no matter how fast the instance is. A busy PostgreSQL primary with frequent checkpoints and WAL flushes can reach that cap before the CPU is busy. Confirm the maximum IOPS for each volume type and size, and whether the figure is per volume or shared across attached volumes.
Burst credit exhaustion
Some volume types allow short bursts above a baseline and refill a credit balance when load drops. A database that passes basic tests can drain those credits during a nightly batch, a vacuum or a large index build, then fall to baseline for the rest of the day. Ask the provider how credits accrue, how large the balance can grow and what happens when it reaches zero.
Instance throughput ceilings
The virtual machine running PostgreSQL has its own bandwidth limit to attached storage, separate from the volume limit. Attaching several fast volumes to a small instance can leave the volumes underused because the instance link is the bottleneck. Compare the instance storage throughput with the combined limits of the data, WAL and backup volumes before choosing an instance size.
Snapshot and backup costs
Volume snapshots and copies of base backups and archived WAL are billed on storage and often on data transfer or request counts. Frequent snapshots of a large data volume can cost more than the volume itself over a retention period. Ask for the price of snapshot storage, incremental behavior, cross-region copies and restore charges, then compare them with the recovery targets your team has set.
Zonal failure scope
A volume usually lives in one availability zone and can only attach to instances in that zone. If the zone fails or the volume is impaired, a standby in another zone needs its own copy of the data to take over. Confirm which volume types can be replicated across zones, what the replication costs in write latency and how you would rebuild a standby after an impairment.
Sustained load testing
Short benchmarks measure peak performance, but PostgreSQL problems usually appear after minutes or hours of steady checkpoints, autovacuum and replication traffic. Run a load test that matches production write volume for long enough to exhaust burst credits and fill the caches, then record fsync latency, queue depth and replication lag. Repeat the test after each volume size or instance change.
Setting up storage for a new PostgreSQL server
This sequence turns a workload and recovery target into a tested storage layout, from disks and cache settings through file systems, checksums, WAL placement and archiving. Each step ends with a check so the server is only handed over once its restore path has been proven.
Confirm workload and recovery targets
Before buying or provisioning anything, write down the expected data size, write rate, peak connection load and the recovery point and recovery time the business needs. The database owner, the application owner and whoever signs off on recovery objectives should agree on these numbers in writing. Ask the vendor or cloud provider for the IOPS and throughput figures their volume types document, and confirm the workload profile with your own load tests where possible. Done means you have a one-page storage brief that the rest of the steps can be checked against.
Select hardware and volumes
Choose the disks or cloud volume types for the data directory and for WAL, and decide whether the layout is one device or separate devices for each. Confirm the controller, its write cache and battery or flash protection, and whether the storage is local, SAN or network-attached, since each changes failure behavior. For cloud volumes, confirm the provisioned IOPS and throughput limits, whether they are burst-based, and whether the provider's documentation covers snapshot consistency. Done means a written bill of materials with every volume and its documented limits listed.
Confirm write cache protection
Verify that every device between PostgreSQL and the platter or flash cell will persist data after a power loss. On hardware RAID, confirm the battery or capacitor is healthy and that the controller switches to write-through if it fails. On drives, check whether volatile write caches are enabled and whether the drive honors flush requests. On cloud volumes, confirm with the provider how flushes are acknowledged. Run a power-loss or flush test in a staging environment if the platform allows it. Done means you have recorded evidence that fsync requests reach durable media, or a documented decision to accept the risk.
Create file systems with chosen options
Create the file systems for the data and WAL volumes using the file system your team has chosen and can support, such as XFS or ext4, and set mount options that match the vendor and distribution guidance. Keep the mount options that affect durability and atime handling consistent across hosts, and document them in the build runbook. If you are using ZFS, follow the separate ZFS tuning topic before creating datasets. Done means the mounts exist, the options appear in the mount table, and a sample write and read succeed on each volume.
Decide data checksums before initdb
Decide whether to enable data checksums before running initdb, because the setting is fixed when the cluster is created. Enabling checksums later requires a separate offline procedure, so this decision belongs in the build plan, not after go-live. Weigh the small performance cost against the ability to detect corruption at read time, and record the decision with its reason. Confirm that your backup and monitoring tools support checksum-enabled clusters. Done means the initdb command with its checksum flag is written into the runbook and reviewed by the database owner.
Place WAL on its own volume
Initialize the cluster with the data directory on the main volume, then move the pg_wal directory to the dedicated WAL volume and create a symbolic link from the data directory, or use the initdb option that places WAL at creation time. Keep WAL on a volume with its own I/O path where the hardware allows it, and check that ownership and permissions are correct for the postgres user. Restart the server and confirm it starts cleanly. Done means the server runs, pg_wal resolves to the WAL volume, and a write-heavy test shows WAL activity on that device.
Set up WAL archiving
Configure archive_mode and archive_command, or an archiving tool that the team has chosen, so completed WAL segments are copied to a location separate from the server. Store the archive off the database host, and confirm that the destination has its own access control and retention rules. Take a base backup with the chosen tool after archiving is working, so point-in-time recovery has a starting point. Done means the archiver reports successful segment copies and the base backup and archive set are listed in the backup catalog.
Run a restore test
Restore the base backup to a separate host with the same storage layout, replay archived WAL to a chosen target time, and start the restored server. Compare row counts or checksums for a sample of tables against the source, and measure how long the restore took against the recovery time target from the first step. Record any gap between the restore result and the targets, and fix it before the server enters production. Done means the restore test is signed off with its timings and results, and the runbook reflects the steps that worked.
Questions buyers ask about PostgreSQL storage
What drives the cost of a PostgreSQL storage design project?
The cost is mostly labor: someone must measure the workload, choose the disk layout and file system, test write cache behavior and document the result. The main drivers are the number of database servers, whether storage is on bare metal, a hypervisor or a cloud platform, how many environments need matching layouts, and how much restore and failover testing is included. One-time work covers design, build and proof testing. Recurring cost appears later in hardware refresh, storage capacity growth and any retainer for ongoing support. Ask for a fixed-scope quote that lists each server class, each storage tier and each test, so you can compare it with your own team's estimate.
How long does it take to decide and build a PostgreSQL storage layout?
The decision period depends on how much measurement you already have. A team with stable workload data and an agreed recovery target can decide faster than a team that must first collect I/O and write patterns. The build period depends on hardware lead times, whether volumes must be provisioned by another group, and how many restore tests are required before go-live. No duration is fixed in this page. Ask for a written timeline in the scope document, with named dependencies such as hardware delivery, network access and change approval windows.
What does the engagement need from our team?
Expect to supply access and decisions, not only approvals. You will need the current database sizes and growth expectations, the write rate on the busiest tables, the recovery point and recovery time targets, the hypervisor or cloud account details, and a named owner for the storage and backup systems. Your operations staff should join the disk and mount tests so they can repeat them later. Confirm with your own change board how new mount points, kernel settings and volume types are approved before the work starts.
Can our own team set up PostgreSQL storage without a partner?
Yes, if your team already runs PostgreSQL in production and has tested Linux storage administration skills. The steps are well documented, and the decisions are the same whether a partner or your staff makes them. The risk lies in the details: write cache settings, filesystem mount options, separate WAL volumes and proof that a restore works. Teams new to these areas often skip the crash and power-loss tests. A partner is useful when you lack that experience, need an independent review, or must show evidence to an assessor.
When should we choose ZFS over XFS or ext4 for PostgreSQL?
Choose ZFS when you want built-in checksumming of data blocks, native snapshots and clones, and compression, and when your team can operate it with memory sized for its cache. Choose XFS or ext4 when you want a simpler stack, lower memory overhead and a file system your operators already know. Both can run PostgreSQL well when the write cache, mount options and WAL placement are correct. The deciding factors are your operations skills, your backup design and your hardware. See the sibling page on running PostgreSQL on ZFS before you decide, because record size and full-page write behavior change the tuning.
Do storage snapshots replace PostgreSQL backups?
No. A snapshot captures a storage state at one moment, and it is not a PostgreSQL backup unless the database is handled in a way that makes that copy consistent, such as a coordinated backup mode or a crash-consistent snapshot that is tested for recovery. Point-in-time recovery needs a base backup plus archived WAL files, which snapshots alone do not provide. Keep snapshots as a fast rollback or clone tool, store independent copies off the storage system, and prove restores work on a separate host. Confirm your snapshot procedure with the PostgreSQL continuous archiving documentation.
How do we enable data checksums on an existing PostgreSQL cluster?
Data checksums are normally set when the cluster is initialized, so enabling them on an existing cluster is a planned maintenance task. Stop the cluster cleanly, run the offline checksum enablement tool for that major version, and start the cluster again. Plan for downtime that scales with database size, and test the procedure on a copy first. Check the PostgreSQL documentation for your exact version, back up the cluster before you begin, and confirm that replicas and backup tools handle the change. If you run a replication pair, plan the order of operations so both nodes end up consistent.
How DeployOpen scopes storage work for PostgreSQL
DeployOpen plans and implements PostgreSQL storage inside your own infrastructure, whether that is your cloud accounts, your data centers or an air-gapped network. The storage decisions in this topic, such as how the data and WAL directories are laid out, which file system is used, whether data checksums are enabled and how snapshots are coordinated with backups, are scoped in writing before any work begins. The written scope names the servers, disks or cloud volumes, the file system and mount options, the PostgreSQL major version, and the deliverables, so that your storage, security and database teams know exactly what will be built and what they must provide. Most engagements are fixed-scope, which means changes to the storage design after sign-off go through a written change to that scope.
A storage scope should also name the checks that prove the design works. DeployOpen tests restores as part of handover, so the backup chain built on the storage (a base backup plus archived WAL, or a snapshot method you have approved) is restored to a separate host and checked before the system is accepted. Ask for the restore test result, the recovery steps as written documentation and the commands used to confirm that WAL replay reached the target point. Confirm with your own team which recovery point and recovery time targets apply, because those figures decide how much storage design effort is needed and cannot be taken from this page.
Ongoing support is available through retainers for teams that want help after handover, for example with capacity growth, volume resizing, file system upgrades or repeated restore tests. A retainer should be quoted from the written scope of that support, and its cost recurs for as long as the retainer runs, while the initial build is one-time. Ask the provider to confirm who holds administrator credentials for the storage layer, who receives alerts about disk latency and free space, and how changes are recorded, because those answers determine whether your team can operate the storage without the provider.

