Skip to content

Record encrypted disks in backup metadata, fix #1670 - #1673

Open
Slach wants to merge 3 commits into
masterfrom
disk_encrypted_metadata_1670
Open

Slach wants to merge 3 commits into
masterfrom
disk_encrypted_metadata_1670

Conversation

@Slach

@Slach Slach commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1670.

disk_types stores only system.disks.type; on 22.9+ an encrypted disk over a local disk is reported as local, so a disk missing on the destination server is indistinguishable from a plain local disk.

  • metadata.json gets disk_encrypted ({"disk_name": true}, omitted when no encrypted disks), filled from system.disks.is_encrypted in create.
  • isCrossDiskDownloadIncompatible: the disk_types fallback for a removed required disk now sets IsEncrypted from disk_encrypted.
  • download re-balance (reBalanceTablesMetadataIfDiskNotExists): disks are grouped by type and encryption. Before, parts of a removed local disk could be re-balanced onto an encrypted disk (and encrypted parts onto a plain disk) — this is the general path, not only the --diff-from-remote one.

Backups created before this change have no disk_encrypted, they behave as before for encrypted sources, but plain parts are no longer placed on encrypted disks.

  • rebalance command, Rule 3 (copy of a part absent from system.parts): chooseRebalanceDstDisk matches is_encrypted too. Before, on 22.9+ a plain part could be copied onto an encrypted disk on least_used_disk, and parts of a removed encrypted disk onto a plain one. Rule 2 (hardlink from the live part) was never affected. Target disks are recorded in disk_encrypted as well.

The target disk encryption comes from live system.disks: 22.9+ has is_encrypted (added in the same change that started reporting the underlying type), before 22.9 type is encrypted itself. disk_encrypted in metadata is needed only for a source disk which no longer exists on the server.

Tests: TestIsCrossDiskDownloadIncompatible (removed encrypted disk cases), new TestReBalanceTablesMetadataIfDiskNotExists_EncryptedDisks, two new TestComputeTableRebalancePlan rule3 cases; both fail without the fix. make test passes.

🤖 Generated with Claude Code

Slach and others added 3 commits November 9, 2026 06:57
disk_types carries only system.disks.type, and 22.9+ reports the
underlying type for an encrypted disk, so a disk absent on the
destination server could not be told apart from a plain local disk.

Store disks with is_encrypted=1 in a new disk_encrypted metadata field
and use it where a missing disk is described by the backup metadata:
- isCrossDiskDownloadIncompatible fallback no longer treats a removed
  encrypted disk as plain local;
- download re-balance groups disks by type and encryption, so parts of
  a removed encrypted disk land only on an encrypted disk and plain
  parts never land on an encrypted one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rule 3 copies shadow files of a part absent from system.parts as is,
and chooseRebalanceDstDisk matched disks by type only. On 22.9+ an
encrypted disk over a local one has type `local`, so a plain part could
be copied onto an encrypted disk on least_used_disk, and ciphertext of a
removed encrypted disk onto a plain one.

Match is_encrypted too: live disks from system.disks.is_encrypted, a
source disk absent on the server from metadata disk_encrypted. Disks
used as rebalance targets are recorded in disk_encrypted as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
curl -sL without -f saved the GitHub "504 Gateway Time-out" HTML page
as /usr/bin/yq, test containers are pooled, so `command -v yq` kept
passing and every later custom rsync/restic/kopia test in that env
failed in init.sh with "syntax error near unexpected token `<'".

Probe yq with `yq --version`, download with -f into a temp file and
install it only after it runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isCrossDiskDownloadIncompatible classifies an encrypted disk absent from system.disks as plain local, so a cross-type diff copy is allowed

1 participant