Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk12 min

How to Back Up, Restore and Migrate PostgreSQL Databases With Barman

A practical Barman runbook for PostgreSQL backups, WAL streaming, restores, point-in-time recovery, and same-major-version migrations, with cross-version caveats and troubleshooting.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Barman gives PostgreSQL administrators a central place to take physical base backups, collect write-ahead logs (WAL), enforce retention, and recover a server to a selected point in time. A reliable deployment uses a dedicated Barman host, a normal database connection, optional streaming and replication credentials, correctly configured WAL delivery, and regular recovery drills. The practical sequence is: configure access, run barman check, take a base backup, verify that the required WAL reaches Barman, and test recovery into an isolated directory before trusting the setup in an incident.

This guide explains how to back up PostgreSQL with Barman, restore a Barman backup, perform point-in-time recovery (PITR), and migrate a database to another server. It also separates same-major-version relocation from cross-major-version migration, because physical replay is not a general-purpose major-version upgrade method.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Barman does and when to use it

Barman (Backup and Recovery Manager) is an open-source Python administration tool for PostgreSQL disaster recovery. Its design centres on physical recovery: Barman stores a complete base backup and the WAL needed to replay changes after that backup. The project lists hot physical backups, point-in-time recovery, remote backup and recovery, WAL archiving and streaming, retention-policy management, compression, incremental backup and recovery, parallel operations, and diagnostic checks among its capabilities.

PostgreSQL’s own documentation states, “As with everything that contains valuable data, PostgreSQL databases should be backed up regularly.” A Barman installation turns that principle into an operational system rather than a one-off copy. It can receive WAL through PostgreSQL’s archive_command, through a streaming archiver, or through both. Continuous streaming can reduce the recovery point objective (RPO) compared with relying only on periodic archive delivery, provided the streaming path and its storage are healthy.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

What Barman is strongest at

  • Centralising physical backups for one or more PostgreSQL servers.
  • Keeping base backups and WAL together in a catalogue that can be checked and queried.
  • Recovering to a new data directory or remote host without overwriting a running instance.
  • Replaying WAL to a timestamp, transaction, or named restore point when the incident plan identifies a target.
  • Applying retention rules that match a business recovery window and available storage.

What Barman does not replace

Barman does not remove the need to choose an RPO and recovery time objective (RTO), protect credentials and backup storage, or test restores. It also does not make a physical PostgreSQL data directory portable across arbitrary major versions. A move from one major PostgreSQL release to another requires a separate logical or dump-based migration design.

Plan the architecture and prerequisites

Use a dedicated Barman host with network access to the PostgreSQL server. Keeping backup management separate from the database host protects the backup catalogue from a failure of the primary machine and gives the operator one place to monitor several servers. The Barman host needs compatible PostgreSQL client utilities when it performs streaming backups.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connections and roles

Define conninfo for normal Barman operations. If Barman will stream WAL or take streaming backups, define streaming_conninfo as well and create a dedicated role with the replication capability required by your PostgreSQL release and chosen operations. Use least privilege: the Barman and streaming accounts should have only the database, replication, and filesystem access they need.

Add the Barman host’s addresses and role names to PostgreSQL’s pg_hba.conf. Reload or restart PostgreSQL according to the change you make, then test each connection from the Barman host. Authentication errors should be fixed before any production backup is scheduled.

PostgreSQL settings

Set wal_level = 'replica' for coherent physical backups. PostgreSQL releases differ in their exact backup and replication settings, so check the manual for the release you operate before applying a configuration copied from another version. Configure WAL delivery with archive_command, a streaming archiver, or both. If you use streaming, configure a replication slot deliberately and monitor the storage consequences of a slot that falls behind.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Storage, security, and recovery objectives

  • Place the Barman catalogue and backup data on storage sized for the selected base-backup frequency, WAL volume, compression choice, and retention period.
  • Restrict access to database credentials, SSH keys, Barman configuration, and backup files.
  • Protect the Barman host and its storage against the same failure domain as the primary database where possible.
  • Choose retention from the organisation’s RPO, RTO, legal requirements, and storage budget. There is no universally correct number of days.
  • Document where a recovered server will run, which application checks prove it is usable, and who can approve a cutover.

Configure a PostgreSQL server in Barman

Barman server definitions are commonly stored as INI files in /etc/barman.d. The following representative stanza describes a streaming-only arrangement:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[pg]
description = "Example of PostgreSQL Database (Streaming-Only)"
conninfo = host=pg user=barman dbname=pagila
streaming_conninfo = host=pg user=streaming_barman dbname=pagila
backup_method = postgres
streaming_archiver = on
slot_name = barman

Replace the hostname, database, role names, authentication method, and slot name with values from your environment. The example is a configuration shape, not a set of credentials to copy unchanged.

Choose the backup method and client binary

For streaming backups, Barman uses PostgreSQL’s pg_basebackup utility. The Barman host must have a compatible client binary. The manual recommends the postgres backup method for streaming backups. When multiple PostgreSQL client versions are installed, use Barman’s path_prefix setting to select the appropriate binaries rather than relying on an accidental default in the shell path.

Decide how WAL reaches Barman

An archive-command configuration copies completed WAL files to Barman. A streaming archiver continuously receives WAL from PostgreSQL. Running both can provide operational resilience, but it also means you must understand which path is responsible for each file and how failures are reported. Whichever design you choose, a base backup is not recoverable until the WAL required after that backup has arrived in Barman’s catalogue.

Validate the configuration before taking production backups

Run the diagnostic check before production use and after every material configuration change:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
barman check SERVER

Substitute the server name from the configuration, such as pg. Treat every reported issue as a release blocker until you understand and resolve it. Typical checks cover connectivity, permissions, required tools, WAL reception, and catalogue state.

Confirm the complete backup chain

  1. Verify that the normal conninfo connection works from the Barman host.
  2. If streaming is enabled, verify streaming_conninfo, the replication role, pg_hba.conf, and the replication slot.
  3. Confirm that the selected pg_basebackup client is compatible with the PostgreSQL server.
  4. Take a base backup and inspect Barman’s catalogue for its status.
  5. Generate or wait for WAL activity, then confirm that the required WAL files arrive through the configured archive or streaming path.
  6. Perform a recovery drill into an empty, isolated target directory.

Do not infer recoverability from the existence of a base-backup directory alone. Missing WAL can leave a catalogue entry that cannot reach the point in time you need.

How to back up PostgreSQL with Barman

Once barman check is clean, schedule base backups according to the recovery window. A base backup is the physical starting point; WAL collected afterward supplies the changes needed for more recent recovery targets. Compression, incremental backups, and parallel operations can reduce storage or elapsed time, but their value depends on your data-change rate, CPU, network, and storage capacity. Measure these choices in your environment rather than assuming a generic improvement.

After each backup

  • Check that the backup completed successfully and is visible in the Barman catalogue.
  • Check that WAL continues to arrive and that no required segment is missing.
  • Record the backup identifier, start and end times, retention class, and the storage location.
  • Review alerts for archive or streaming lag and for a replication slot that is retaining unexpected WAL.
  • Keep enough base backups and WAL to cover the documented business recovery window.

Retention is a policy, not a default

Barman can manage retention policies, but the retention period must come from your incident scenarios and obligations. A short retention may save storage while eliminating the ability to investigate an older corruption event. A long retention increases storage and protection requirements. Write down the oldest point in time that must remain recoverable and test that the policy actually preserves it.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to restore a Barman backup safely

The core recovery form is:

barman recover SERVER BACKUP_ID /path/to/recover/dir

Run it against a stopped, empty, or dedicated target data directory. Never point barman recover at the data directory of a live PostgreSQL instance. For a replacement server, provision the operating system, PostgreSQL binaries, users, mounts, and network identity first, then recover into the new data directory.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Restore procedure

  1. Identify the Barman server definition and the backup identifier to restore.
  2. Stop PostgreSQL on the target host, or use a new empty directory that is not used by a running instance.
  3. Ensure the target has adequate capacity for the database, tablespaces, and replayed WAL.
  4. Run barman recover SERVER BACKUP_ID /path/to/recover/dir from an account authorised to read the Barman catalogue and write the destination.
  5. If the destination paths differ, use Barman’s recovery-time relocation options for the data directory and tablespaces.
  6. Configure the recovered instance to obtain WAL through the local get-wal facility or a remote WAL restore path.
  7. Start PostgreSQL and wait for recovery to finish; the time depends on backup size, WAL volume, storage, and server resources.
  8. Validate database contents, roles, extensions, tablespaces, application queries, and any integrity checks required by your service.

Local and remote WAL retrieval

A local recovery can use Barman’s get-wal facility to retrieve archived WAL. For a remote recovery, barman-wal-restore can fetch WAL over SSH and provides handling for SSH connection errors, compression and decompression, and prefetch (also called “peek”) behaviour. Configure SSH key authentication and least-privilege access before depending on this path. Test the exact account, host key, command path, and permissions during a drill rather than during an outage.

How to perform point-in-time recovery with Barman

Point-in-time recovery starts with a base backup and replays WAL until a selected target. Your incident plan may specify a timestamp, a transaction, or a named restore point. Select the target that stops the unwanted change while retaining legitimate work, and record the time zone and evidence used to choose it.

PITR workflow

  1. Choose a base backup whose end time is before the desired recovery target.
  2. Confirm that Barman has every WAL segment from that backup through the target. If the chain is incomplete, choose another backup or repair WAL delivery before proceeding.
  3. Recover into an isolated data directory, not over the production instance.
  4. Configure local get-wal or remote barman-wal-restore delivery.
  5. Set the recovery target supported by your installed Barman and PostgreSQL versions: timestamp, transaction, or named restore point.
  6. Start PostgreSQL and monitor the recovery log until it reaches the target and becomes available for read-only validation.
  7. Verify the affected rows, application state, permissions, jobs, and external integrations. Only then decide whether to promote the recovered instance and redirect traffic.

The cited Barman documentation describes the command mechanics, not a universal recovery-time or recovery-success statistic. Measure your own RPO and RTO during drills, including time to provision a target, transfer or access backup data, replay WAL, validate applications, and perform the cutover.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to migrate PostgreSQL to a new server with Barman

For a same-major-version move, Barman can relocate a physical data directory and tablespaces during recovery. The migration is a controlled restore followed by validation and cutover, not merely a file copy.

Same-major-version migration runbook

  1. Provision the destination host with a PostgreSQL release compatible with the source physical backup, matching required extensions and operating-system dependencies.
  2. Install compatible Barman tooling and PostgreSQL client binaries on the destination or the machine performing the recovery.
  3. Prepare destination mounts and directories for the data directory and every tablespace.
  4. Choose the latest validated base backup that satisfies the planned cutover and confirm its WAL chain.
  5. Recover the backup into the destination paths, applying relocation settings where paths differ.
  6. Replay WAL to the planned cutover point. For minimal data loss, coordinate a write freeze or application stop and choose a target that includes all accepted transactions.
  7. Start PostgreSQL and run validation checks: connectivity, schema, row counts or business totals, extensions, roles, scheduled jobs, and representative application transactions.
  8. Stop writes on the old server, take or identify the final WAL boundary required by your plan, complete recovery on the destination, and repeat validation.
  9. Repoint applications, monitoring, connection pools, and backup jobs only after the destination starts cleanly and the validation owner approves it.
  10. Keep the old server isolated and retain a documented rollback path until the agreed observation period ends.

Cross-major-version moves

A physical base-backup replay is tied to PostgreSQL compatibility. If the destination major version differs, design a version-appropriate logical or dump-based migration instead, and document that runbook separately from the Barman restore procedure. The Barman restore steps above can still help recover a compatible staging instance for testing, but they are not a complete cross-major upgrade plan.

Barman compared with other PostgreSQL backup approaches

The right comparison is operational, not just a list of features. Examine what can be recovered, how WAL moves, which RPO and RTO are achievable in your environment, how retention is enforced, whether a major-version move is supported, and how often restores are tested.

Approach Recovery model WAL and PITR Version migration Operational considerations
Barman physical backup Centralised physical base backups and data-directory recovery Archive-command and/or streaming WAL; PITR to a target supported by the installation Best suited to the same major version; not a general cross-major upgrade tool Requires a Barman host, database access, WAL monitoring, retention policy, and restore drills
PostgreSQL logical dump and restore Logical objects and rows recreated in a target cluster Usually a migration or periodic backup workflow rather than continuous physical replay Can be appropriate for cross-major moves when the dump and extensions are compatible Requires planning for dump duration, restore duration, roles, extensions, and sequence or ownership details
Native WAL archiving without a central manager Physical recovery assembled from a base backup and archived WAL Can support PITR if archive integrity and retrieval are managed correctly Still constrained by physical-version compatibility Fewer management abstractions, but more scripting and monitoring responsibility falls on the operator
Filesystem or storage snapshots Storage-level image of a database volume PITR depends on a separately reliable WAL design Does not itself solve major-version migration Consistency, snapshot durability, portability, and restore testing depend on the storage platform

Barman is strongest when you want centralised physical backup, managed WAL handling, repeatable recovery operations, and diagnostics around PostgreSQL servers. A logical method may be the better fit when the primary requirement is a cross-major-version transformation rather than rapid physical failover.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the failures that prevent recovery

barman check reports connection or authentication errors

Recheck hostnames, database names, role names, passwords or certificates, and the matching pg_hba.conf rules. Test from the Barman host, not only from the database server. Confirm that the server definition uses the intended conninfo and, for streaming operations, streaming_conninfo.

The streaming backup cannot find a compatible client

Install a PostgreSQL client version compatible with the server and select it explicitly with path_prefix when several versions are present. Confirm which pg_basebackup binary Barman invokes before repeating the backup.

WAL is missing after a successful base backup

Inspect the archive-command or streaming-archiver path, replication-slot status, permissions, and available storage. A base backup is not recoverable to later points until the required WAL is in the Barman catalogue. Do not delete or expire the only usable WAL chain while investigating.

Remote recovery fails over SSH

Verify the destination account, key permissions, known-hosts entry, network route, remote command path, and read access to Barman’s WAL files. Run a small manual SSH test as the same account used by barman-wal-restore, then repeat the recovery drill.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The restore was attempted on a live data directory

Stop the instance immediately if it is safe to do so and assess whether files were changed. The supported safe pattern is a stopped target or a new empty directory. For future drills, enforce a separate recovery path and require an explicit directory check before running barman recover.

The recovered database starts but applications fail

Check roles, passwords, extensions, tablespace paths, DNS or connection endpoints, background jobs, and data consistency at the selected recovery target. A PostgreSQL process reaching “ready” status is not the same as a completed service recovery; application-level validation is required before cutover.

Operational checklist for a dependable Barman deployment

  1. Create least-privilege Barman and streaming roles and verify pg_hba.conf access.
  2. Configure conninfo, streaming_conninfo when needed, backup_method, WAL archiving or streaming, and any replication slot.
  3. Run barman check SERVER and resolve every reported issue.
  4. Take a base backup and confirm both catalogue status and continuing WAL arrival.
  5. Protect Barman storage, credentials, SSH keys, and retention configuration.
  6. Perform a recovery drill into an isolated target directory.
  7. Test PITR and record the achieved RPO and RTO, including validation and cutover time.
  8. Rehearse migration cutover and rollback before changing production traffic.
  9. Review retention and storage consumption against the business recovery window.
  10. Repeat the drill after PostgreSQL, Barman, operating-system, network, authentication, or storage changes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.