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.
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
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.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.
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 | β |
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):
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.
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.
Image backup: "Image backups (newest first)", the snapshot choice; with
snapshot = "latest"andhostnamethe question is skipped.Disks in the backup, if the image holds several.
Target disk: only disks that are not the recovery medium and at least as large as the image are offered.
If the target is larger, the question whether to grow the last data partition ("Grow the last data partition? (y/n)").
Confirmation: type
YES. The target is overwritten.The restore runs with progress. With the server it is a normal run (visible under Runs, with progress).
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 |
|---|---|---|
| Skips the final |
|
| Reboot after success; if the key is missing, the console asks. | ask |
|
|
|
| Interface (default: first Ethernet interface with a link) and, for | β |
| Agent endpoint of the server (e.g. | β |
|
|
|
| Local: repository folder. SMB: folder inside the share ( | β |
| S3 access. |
|
| Repository passphrase. | β |
|
| β |
| Only images of this host (for | β |
| Disk key in the snapshot ( | β |
| Target device or path of an image file. | β |
| Grow the last partition if the target is larger. | β |
| Image file targets only. | β |
| 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 |
|---|---|---|
| Required. Path to the Windows | β |
| Working directory. If it exists the script stops unless |
|
|
| β |
| NIC and storage drivers that WinPE itself needs on the new machine (injected into | β |
| Drivers for the restored Windows; they go to | β |
| Path of the ISO to create. At least | β |
| Drive letter of the USB stick (e.g. | β |
| Boot files signed by the Windows UEFI CA 2023 (ADK 10.1.26100.2454 or later). | off |
| Discard an existing | 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 |
|---|---|---|
| More driver folders (searched recursively); relative paths are taken from the medium. |
|
| Accept unsigned drivers ( |
|
| Set the inbox storage drivers to start at boot, so a system moved from another controller finds its disk. |
|
| Recreate the boot files with |
|
|
|
|
| Skip all of this (restore only). |
|
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.