On this page

9.6 Recovery media and bare-metal restore

A machine that no longer boots, or one with a new hard disk, can only be restored from a recovery medium: it starts a small system with the agent in recovery mode and writes an image backup to the disk. This requires a Whole machine (1:1) job, that is, an image job (see chapter 06 Jobs). There are two media: the Linux recovery medium (ISO) for the normal case and a WinPE medium for Windows on different hardware.

The Recovery medium page

The Recovery medium page offers the ISO for download (Download ISO, with file name, size, file date and SHA-256), creates recovery tokens and lists the Recovery consoles that have registered with them.

Recovery medium and recovery token
Recovery medium and recovery token

The Linux recovery medium (ISO)

The medium is a small Linux live system (UEFI and legacy BIOS, CD or USB stick) with the agent in recovery mode. One stick fits all machines and has to be created only once.

Providing the ISO

The Windows server setup installs the ready-made ISO through the optional component Recovery medium (ISO) into <data dir>\recovery. If the Recovery medium page shows no ISO, run the server setup again and select this component, or place pdc-recovery.iso in <data dir>/recovery/ on the server. The newest *.iso there is shown.

Without an ISO the Recovery medium page shows a hint. On download the server sends the checksum in the X-PDC-SHA256 header; the download is audited.

Write the stick and create a token

  1. Open Recovery medium and click Download ISO. Write the ISO to a USB stick (Linux: dd if=pdc-recovery.iso of=/dev/sdX bs=4M; Windows: Rufus in DD mode) or burn it.

  2. Check the Server address for the console and create a Recovery token (table below). The token is shown once: note Server (enter in the console) and Token.

  3. Boot the machine from the stick (UEFI or legacy BIOS).

Option when creating the token

Effect

Default

Server address for the console

Address under which the console reaches the server. It must be in the server certificate, otherwise the console refuses the connection ("is not in the server certificate"); use a name listed under Settings. The console verifies the server by its CA.

–

Valid for

1 hour, 4 hours or 24 hours. In the API ttl_minutes.

–

Note

Free text, e.g. "Anna's laptop, new SSD".

empty

I understand that this token can restore any machine's image.

Required check mark. A recovery token is a master key: the console it enrolls can list the image backup of every machine and restore it onto the disks of the machine it runs on.

–

A recovery token is single use. Create it right before the restore and remove the console afterwards (Remove… in the Recovery consoles list). The lists Recovery tokens (Created, Note, State: "valid, expires …", "used …", "expired", Delete) and Recovery consoles (Console, Host, IP address, Enrolled, Last seen, Restore runs) show what is open. In the API this is POST /enrollment-tokens with {"server_host":"backup-pc","recovery":true,"ttl_minutes":1440}.

Procedure at the recovery console

The console starts on the first terminal and asks in this order (each question is skipped when the configuration file provides the answer):

  1. Network: DHCP, a static address (address, gateway, DNS), or leave the network as it is. Without a setting the first Ethernet interface with a link is used.

  2. Source: either the PDC-Backup server (server address and recovery token) or a repository opened directly (local disk/USB, SMB share, S3) with its passphrase.

  3. Image backup: "Image backups (newest first)", the snapshot choice; with snapshot = "latest" and hostname the question is skipped.

  4. Disks in the backup, if the image holds several.

  5. Target disk: only disks that are not the recovery medium and at least as large as the image are offered.

  6. If the target is larger, the question whether to grow the last data partition ("Grow the last data partition? (y/n)").

  7. Confirmation: type YES. The target is overwritten.

  8. The restore runs with progress. With the server it is a normal run (visible under Runs, with progress).

  9. Reboot ("Reboot now? (y/n)"). After growing, extend the file system from the restored system (Windows: Disk Management "Extend Volume"; Linux: resize2fs/xfs_growfs).

When the console ends, the medium asks: [r]estart, [s]hell, re[b]oot, [p]ower off.

New hard disk

For a machine with a new, empty disk the same procedure applies: pick the new disk as the target disk. If it is larger than the old one, confirm growing the last partition and extend the file system in the restored system afterwards. A disk smaller than the image is not offered.

pdc-recovery.toml

A file pdc-recovery.toml in the root of the stick answers any question in advance. Alternatively, pass it with pdc.config=<path> on the kernel command line. Search order on Linux: pdc.config=, then /run/live/medium/pdc-recovery.toml, /run/pdc-recovery/pdc-recovery.toml, /etc/pdc-recovery.toml. On WinPE: X:\pdc\pdc-recovery.toml, then the root of every drive (C: to Z:). All values are optional. Unknown keys make the file invalid. With pdc.unattended on the kernel command line the console runs without questions; if a value is missing it stops with a message. pdc.poweroff powers off afterwards.

# Restore without the final "YES" question (unattended restores only).
confirm = false
# Reboot after a successful restore (omit: ask).
# reboot = true

[network]
mode = "dhcp"            # dhcp | static | none
# interface = "enp1s0"
# address = "192.168.1.50/24"
# gateway = "192.168.1.1"
# dns = ["192.168.1.1"]

# Either a PDC-Backup server (token of kind "recovery") ...
[server]
url = "https://backup-pc:8444"
# token = "pdc1...."

# ... or a repository opened directly (omit [server] then).
# [repository]
# kind = "local"           # local | smb | s3
# path = "/mnt/usb/pdc-repo"
# share = "//nas/backup"   # smb
# username = "backup"      # smb
# endpoint = "https://s3.example.net"   # s3
# bucket = "pdc"                        # s3
# access_key_id = "..."                 # s3
# password = "repository passphrase"

[restore]
# snapshot = "latest"      # or a snapshot ID
# hostname = "office-pc"
# disk = "disk0"
# target = "/dev/sda"
# grow_last_partition = true

Key

Effect

Default

confirm

Skips the final YES question (unattended only).

false

reboot

Reboot after success; if the key is missing, the console asks.

ask

[network] mode

dhcp, static or none (leave the network as it is).

dhcp

[network] interface, address, gateway, dns

Interface (default: first Ethernet interface with a link) and, for static, address with prefix (192.168.1.50/24), gateway and DNS servers.

–

[server] url, token

Agent endpoint of the server (e.g. https://backup-pc:8444) and recovery token.

–

[repository] kind

local, smb or s3.

local

[repository] path, share, username, smb_password

Local: repository folder. SMB: folder inside the share (path) plus //nas/backup, user, password.

–

[repository] endpoint, bucket, prefix, region, access_key_id, secret_access_key, virtual_host_style

S3 access.

prefix empty; region us-east-1

[repository] password

Repository passphrase.

–

[restore] snapshot

latest or a snapshot ID (prefix).

–

[restore] hostname

Only images of this host (for latest and the list).

–

[restore] disk

Disk key in the snapshot (disk0).

–

[restore] target

Target device or path of an image file.

–

[restore] grow_last_partition

Grow the last partition if the target is larger.

–

[restore] target_size_bytes

Image file targets only.

–

[windows]

WinPE only, see below.

–

WinPE medium (Windows on different hardware)

To run a Windows image on different hardware (new mainboard, other storage controller, NVMe instead of SATA), the second medium is WinPE with the Windows agent in recovery mode. After the image is written, the console finds the restored Windows, adds the drivers from pdc-drivers on the medium (DISM /Image:W:\ /Add-Driver /Driver:<folder> /Recurse), sets the inbox storage drivers (storahci, stornvme, iaStorV, storvsc, vioscsi, viostor, where present) to start at boot in the offline SYSTEM hive, and recreates the boot files (bcdboot W:\Windows /s S: /f UEFI, or BIOS for MBR disks). Network comes from wpeutil InitializeNetwork (DHCP) or netsh (static address); SMB repositories are connected with net use.

The WinPE medium is created once by the administrator with the script build-winpe.ps1. It needs a Windows PC with the Windows ADK and its WinPE add-on and is run in an elevated PowerShell (Windows PowerShell 5.1 or PowerShell 7):

.\build-winpe.ps1 -AgentExe \pdc-agent.exe -Config .\pdc-recovery.toml `
    -WinPEDrivers D:\drivers\winpe -TargetDrivers D:\drivers\new-pc -Iso C:\pdc-winpe.iso

Parameter

Effect

Default

-AgentExe

Required. Path to the Windows pdc-agent.exe.

–

-WorkDir

Working directory. If it exists the script stops unless -Force is given.

C:\PDC_WinPE_amd64

-Config

pdc-recovery.toml to put on the medium.

–

-WinPEDrivers

NIC and storage drivers that WinPE itself needs on the new machine (injected into boot.wim).

–

-TargetDrivers

Drivers for the restored Windows; they go to pdc-drivers on the medium.

–

-Iso

Path of the ISO to create. At least -Iso or -Usb is required.

–

-Usb

Drive letter of the USB stick (e.g. P:).

–

-BootEx

Boot files signed by the Windows UEFI CA 2023 (ADK 10.1.26100.2454 or later).

off

-Force

Discard an existing -WorkDir.

off

The script mounts boot.wim, adds the packages WinPE-WMI, WinPE-SecureStartup (manage-bde for BitLocker) and WinPE-EnhancedStorage, places X:\pdc\pdc-agent.exe and the configuration, writes startnet.cmd (wpeinit, then the console; exit returns to a command prompt) and creates the ISO or stick with MakeWinPEMedia.

The [windows] section in pdc-recovery.toml controls the step after the restore:

Key

Effect

Default

drivers

More driver folders (searched recursively); relative paths are taken from the medium.

pdc-drivers if it exists

force_unsigned

Accept unsigned drivers (DISM /ForceUnsigned). With Secure Boot, Windows still refuses unsigned boot drivers.

false

enable_inbox_storage

Set the inbox storage drivers to start at boot, so a system moved from another controller finds its disk.

true

repair_boot

Recreate the boot files with bcdboot.

true

firmware

auto (UEFI for a GPT with an EFI system partition, BIOS for MBR), uefi, bios or all (/f ALL).

auto

skip

Skip all of this (restore only).

false

Limits:

  • Secure Boot: WinPE from the ADK is signed and boots with Secure Boot on. Machines that revoked the 2011 boot manager (KB5025885) need -BootEx. The restored Windows loads only signed boot drivers while Secure Boot is on.

  • BitLocker (not yet tried on real installations): image backups read NTFS volumes through their VSS shadow copy, which presents the unlocked volume; a restored volume would then be a plain NTFS volume and BitLocker has to be turned on again. Volumes read raw stay encrypted and must be unlocked in WinPE with manage-bde -unlock. TPM-bound keys do not move to new hardware: keep the recovery key at hand.

  • Storage controllers: the inbox drivers cover AHCI, NVMe, Intel RST, Hyper-V and virtio SCSI; RAID controllers and vendor NVMe drivers must be in pdc-drivers. Activation, licensing and vendor software tied to the old hardware are not handled.

Last updated Nov 16, 2026