Skip to main content

Backup Schedule

Description

The px pxb backupschedule commands manage recurring backup schedules. A backup schedule ties a schedule policy (when/how often to run) with backup parameters (what to back up, where to store it). You can create, update, list, delete schedules, and suspend/resume them in bulk.

Usage

Create Backup Schedule

px pxb create backupschedule --name <schedule-name> --cluster <cluster-name> \
--schedule-policy-name <policy> --backup-location-name <location> [flags]

Get Backup Schedule (Inspect)

px pxb get backupschedule --name <schedule-name> [--uid <uid>] [flags]

Get Backup Schedule (List All)

px pxb get backupschedule [flags]

Update Backup Schedule (Single)

px pxb update backupschedule --name <schedule-name> --uid <uid> [flags]

Update Backup Schedule (Bulk)

px pxb update backupschedule --backup-object-type <type> --cluster-scope <scope> \
--include-filter <pattern> [filters] [flags]

Delete Backup Schedule(s)

px pxb delete backupschedule [--name <schedule-name> --uid <uid>] [filters] [flags]

Suspend / Resume Backup Schedule(s)

px pxb suspend backupschedule [filters] [flags]
px pxb resume backupschedule [filters] [flags]

Examples

Create a Daily Schedule for Namespaces

px pxb create backupschedule \
--name daily-sched \
--cluster prod \
--schedule-policy-name daily-8am \
--backup-location-name s3-primary \
--namespace "app1,app2"

Create a Label-Selected Schedule

px pxb create backupschedule \
--name team-sched \
--cluster prod \
--schedule-policy-name hourly \
--backup-location-name s3-primary \
--ns-label-selectors "team=platform"

Create a VirtualMachine Backup Schedule with Specific Resources

px pxb create backupschedule \
--name vm-backup-sched \
--cluster vm-cluster \
--schedule-policy-name daily-8am \
--backup-location-name nfs-backup \
--backup-object-type VirtualMachine \
--namespaces default \
--include-resources "vm1:default:kubevirt.io:v1:VirtualMachine,vm2:default:kubevirt.io:v1:VirtualMachine"

Update a Single Schedule

# Update schedule policy for a specific schedule
px pxb update backupschedule \
--name daily-sched \
--uid schedule-12345 \
--policy-name new-policy \
--policy-uid policy-456

# Suspend a specific schedule
px pxb update backupschedule \
--name daily-sched \
--uid schedule-12345 \
--suspend true

Bulk Update Schedules

# Bulk update all schedules to use a new policy
px pxb update backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-filter "*" \
--policy-name new-policy

# Bulk suspend schedules matching a pattern
px pxb update backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-filter "prod-*" \
--suspend true

# Bulk update specific schedules by name:uid
px pxb update backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-objects "schedule1:uid1,schedule2:uid2" \
--policy-name maintenance-policy

# Bulk update with exclude filter
px pxb update backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-filter "*" \
--exclude-filter "*test*" \
--suspend false

# Bulk update with name-only policy reference (relaxed UID check)
px pxb update backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-filter "*" \
--policy-refs "new-policy" \
--bulk-uid-check-relaxation

Suspend and Resume

# Suspend a specific schedule
px pxb suspend backupschedule --name daily-sched --uid schedule-12345

# Resume a specific schedule
px pxb resume backupschedule --name daily-sched --uid schedule-12345

# Bulk suspend across all clusters for all object types
px pxb suspend backupschedule --backup-object-type All --cluster-scope All --include-filter "*"

# Bulk resume schedules matching a pattern in a cluster
px pxb resume backupschedule --backup-object-type All --cluster-scope prod --include-filter "daily-"

# Suspend schedules using name-only policy reference (relaxed UID check)
px pxb suspend backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-filter "*" \
--policy-refs "maintenance-policy" \
--bulk-uid-check-relaxation

# Resume with remark
px pxb resume backupschedule \
--name daily-sched \
--uid schedule-12345 \
--remark "Resuming after maintenance window"

Note: Suspend and resume operations preserve all schedule configuration including namespaces, label selectors, backup location, CSI snapshot class mappings, exec rules, and all other settings. Only the suspend state is modified.

Delete Schedules with Filters

# Bulk delete across all clusters for all object types (match all)
px pxb delete backupschedule --backup-object-type All --cluster-scope All --include-filter "*"

# Delete schedules using name-only policy reference (relaxed UID check)
px pxb delete backupschedule \
--backup-object-type All \
--cluster-scope All \
--include-filter "*" \
--policy-refs "old-policy" \
--bulk-uid-check-relaxation

Create from file

px pxb create backupschedule --file /path/to/backupschedule-create.json
{
"createMetadata": { "name": "daily-sched" },
"schedulePolicyRef": { "name": "daily-8am" },
"backupLocationRef": { "name": "s3-primary" },
"clusterRef": { "name": "prod" },
"namespaces": ["app1", "app2"]
}

Flags for commands and sub-commands

Create Backup Schedule Flags

Required Flags

FlagShortTypeDescription
--name-nstringName of the backup schedule (required, optional with --file)
--schedule-policy-namestringName of the schedule policy (required, optional with --file)
--backup-location-namestringName of the backup location (required, optional with --file)
--cluster-cstringName of the cluster (required, optional with --file)

Optional Identification

FlagShortTypeDescription
--uidstringUID of the backup schedule (optional)
--schedule-policy-uidstringUID of the schedule policy
--backup-location-uidstringUID of the backup location
--cluster-uidstringUID of the cluster

Resource Selection

FlagShortTypeDescription
--namespace[]stringNamespaces to back up (comma-separated)
--namespaces-filestringYAML/JSON file containing namespaces array
--ns-label-selectorsstringNamespace label selectors
--label-selectorsmapResource label selectors (key=value,key2=value2)
--label-selectors-filestringYAML/JSON file with label selectors
--advanced-resource-label-selectorstringAdvanced selector (supports operators)
--resource-types[]stringResource kinds to include
--resource-types-filestringYAML/JSON file with resource types
--exclude-resource-types[]stringResource kinds to exclude
--exclude-resource-types-filestringYAML/JSON file with excluded resource types
--include-resourcesstringSpecific resources to include (name:namespace:group:version:kind list, comma-separated)
--include-resources-filestringYAML/JSON file with specific resources to include

Execution Rules and Behavior

FlagShortTypeDescription
--pre-exec-rule-namestringPre-execution rule name
--pre-exec-rule-uidstringPre-execution rule UID
--post-exec-rule-namestringPost-execution rule name
--post-exec-rule-uidstringPost-execution rule UID
--skip-vm-auto-exec-rulesboolSkip automatic execution rules for VM backups
--parallel-backupboolEnable parallel backups
--direct-kdmpboolUse direct KDMP for data movement
--keep-cr-statusboolInclude custom resource status

Storage and Snapshots

FlagShortTypeDescription
--csi-snapshot-mappingmapprovisioner=volumesnapshotclass mapping
--volume-snapshot-class-mapping-filestringYAML/JSON file with snapshot class mapping
--volume-resource-only-policy-namestringName of volume resource only policy
--volume-resource-only-policy-uidstringUID of volume resource only policy

Policies and Types

FlagShortTypeDescription
--backup-object-typestringAll (default), VirtualMachine, or NS

File Input

FlagShortTypeDescription
--filestringYAML/JSON file with complete schedule specification

Get Backup Schedule Flags

Resource Identification

FlagShortTypeDescription
--name-nstringName of the schedule to inspect (required for inspect; omit to list all)
--uid-ustringUID of the schedule (optional; used with --name)

Filtering

FlagShortTypeDescription
--backup-location-namestringFilter by backup location name
--backup-location-uidstringFilter by backup location UID
--backup-object-typestringFilter by backup object type: All, VirtualMachine, or NS

Advanced Filtering

FlagShortTypeDescription
--include-objects[]stringInclude specific schedules by name
--exclude-objects[]stringExclude specific schedules by name
--include-filterstringInclude filter expression
--exclude-filterstringExclude filter expression
--policy-refs[]stringFilter by schedule policy references
--cluster-scopestringCluster scope: All or name[:uid][,name2[:uid2]...]

Listing and Display

FlagShortTypeDescription
--max-objectsuint64Maximum number of schedules to retrieve (0 for no limit)
--sort-bystringSort by: name, create_time, update_time, cluster
--sort-orderstringasc or desc (default: asc)
--detailedboolShow detailed schedule information

Update Backup Schedule Flags

Single Update Mode - Required Identification

FlagShortTypeDescription
--name-nstringName of the schedule to update (required for single update)
--uid-ustringUID of the schedule to update (required for single update)

Bulk Update Mode - Required Filters

FlagShortTypeDescription
--backup-object-typestringBackup object type (required for bulk update; valid values: NS, VM, All)
--cluster-scopestringCluster scope (required for bulk update; valid values: All or name[:uid][,name2[:uid2]...])
--include-filterstringInclude filter regex pattern (required for bulk update; use * to match all within scope; mutually exclusive with --include-objects)

Bulk Update Mode - Optional Filters

FlagShortTypeDescription
--include-objectsstringsInclude specific backup schedules by name or name:uid (comma-separated; mutually exclusive with --include-filter)
--exclude-objectsstringsExclude specific backup schedules by name or name:uid (comma-separated; mutually exclusive with --exclude-filter)
--exclude-filterstringExclude filter regex pattern (mutually exclusive with --exclude-objects)
--policy-refsstringsPolicy references for bulk update (name or name:uid)

Update Fields (Both Modes)

FlagShortTypeDescription
--policy-namestringNew schedule policy name
--policy-uidstringNew schedule policy UID
--pre-exec-rule-namestringPre-execution rule name
--pre-exec-rule-uidstringPre-execution rule UID
--post-exec-rule-namestringPost-execution rule name
--post-exec-rule-uidstringPost-execution rule UID
--label-selectorsmapUpdate resource label selectors
--csi-snapshot-mappingmapUpdate CSI snapshot class mapping
--parallel-backupboolEnable/disable parallel backups
--suspendstringSuspend the schedule: true or false

File Input

FlagShortTypeDescription
--filestringYAML/JSON with complete update configuration (skips validation)
--label-selectors-filestringYAML/JSON file with label selectors
--volume-snapshot-class-mapping-filestringYAML/JSON file with snapshot class mapping
--include-objects-filestringYAML/JSON file containing include objects list
--exclude-objects-filestringYAML/JSON file containing exclude objects list
--policy-refs-filestringYAML/JSON file containing policy references list

Bulk Operation Options

FlagShortTypeDescription
--bulk-uid-check-relaxationboolRelax UID check for bulk operations when using name-only references (e.g., policy-refs with name only). When enabled, allows filtering by object names without requiring UIDs, accepting potential side effects if multiple objects share the same name.

Delete Backup Schedule Flags

Identification (single deletion)

FlagShortTypeDescription
--name-nstringName of the backup schedule to delete (required for single deletion)
--uid-ustringUID of the backup schedule (optional)

Bulk Filters

FlagShortTypeDescription
--include-objects[]stringInclude schedules by name
--exclude-objects[]stringExclude schedules by name
--include-filterstringInclude filter expression
--exclude-filterstringExclude filter expression
--backup-object-typestringRequired for bulk: All, VirtualMachine, or NS
--policy-refs[]stringFilter by schedule policy references
--cluster-scopestringCluster scope: All or name[:uid][,name2[:uid2]...]

Deletion Behavior

FlagShortTypeDescription
--forceboolForce deletion even if the schedule is in use

Bulk Operation Options

FlagShortTypeDescription
--bulk-uid-check-relaxationboolRelax UID check for bulk operations when using name-only references (e.g., policy-refs with name only). When enabled, allows filtering by object names without requiring UIDs, accepting potential side effects if multiple objects share the same name.

Suspend Backup Schedule Flags

Identification (single suspension)

FlagShortTypeDescription
--name-nstringName of the backup schedule to suspend (required for single suspension)
--uid-ustringUID of the backup schedule (optional)

Bulk Filters

FlagShortTypeDescription
--include-objects[]stringInclude schedules by name
--exclude-objects[]stringExclude schedules by name
--include-filterstringInclude filter expression
--exclude-filterstringExclude filter expression
--backup-object-typestringRequired for bulk: All, VirtualMachine, or NS
--policy-refs[]stringFilter by schedule policy references
--cluster-scopestringCluster scope: All or name[:uid][,name2[:uid2]...]

Important: Bulk suspend does not accept --name. Use the Bulk Filters above and set --backup-object-type.

File Input (suspend)

FlagShortTypeDescription
--filestringYAML/JSON API request for bulk suspend
--include-objects-filestringYAML/JSON list of names to include
--exclude-objects-filestringYAML/JSON list of names to exclude
--policy-refs-filestringYAML/JSON list of policy references

Bulk Operation Options (suspend)

FlagShortTypeDescription
--bulk-uid-check-relaxationboolRelax UID check for bulk operations when using name-only references (e.g., policy-refs with name only). When enabled, allows filtering by object names without requiring UIDs, accepting potential side effects if multiple objects share the same name.

Resume Backup Schedule Flags

Identification (single resumption)

FlagShortTypeDescription
--name-nstringName of the backup schedule to resume (required for single resumption)
--uid-ustringUID of the backup schedule (optional)

Bulk Filters

Important: Bulk resume does not accept --name. Use the Bulk Filters above and set --backup-object-type.

FlagShortTypeDescription
--include-objects[]stringInclude schedules by name
--exclude-objects[]stringExclude schedules by name
--include-filterstringInclude filter expression
--exclude-filterstringExclude filter expression
--backup-object-typestringRequired for bulk: All, VirtualMachine, or NS
--policy-refs[]stringFilter by schedule policy references
--cluster-scopestringCluster scope: All or name[:uid][,name2[:uid2]...]

File Input (resume)

FlagShortTypeDescription
--filestringYAML/JSON API request for bulk resume
--include-objects-filestringYAML/JSON list of names to include
--exclude-objects-filestringYAML/JSON list of names to exclude
--policy-refs-filestringYAML/JSON list of policy references

Bulk Operation Options (resume)

FlagShortTypeDescription
--bulk-uid-check-relaxationboolRelax UID check for bulk operations when using name-only references (e.g., policy-refs with name only). When enabled, allows filtering by object names without requiring UIDs, accepting potential side effects if multiple objects share the same name.

Notes

  • Get dual mode: without --name enumerates; with --name inspects one (optionally add --uid).
  • Create: when not using --file, --schedule-policy-name, --backup-location-name, and --cluster are required.
  • Update: when not using --file, both --name and --uid are required. With --file, identifiers may come from the file; CLI flags override file values.
  • Delete: choose either single deletion (--name required; --uid optional) or bulk filters; do not mix single and bulk flags.
  • Suspend/Resume: choose single or bulk; do not mix. For bulk, --backup-object-type is required (valid: All, VirtualMachine, NS). --include-objects is mutually exclusive with --include-filter, and --exclude-objects with --exclude-filter.
  • Precedence: CLI flags override granular *-file inputs, which override --file.
  • Include Resources: Use --include-resources to specify individual resources to back up. Format: name:namespace:group:version:kind (comma-separated for multiple resources). Mutually exclusive with --include-resources-file. When using --include-resources for VirtualMachine backups, it's recommended to also specify --namespaces to avoid server-side errors.

Bulk Operation Rules (delete/suspend/resume/update)

  • Bulk mode is triggered only when any of these are set: --include-objects, --exclude-objects, --include-filter, or --exclude-filter.
  • In bulk mode, all of the following are REQUIRED:
    • --backup-object-type (valid: All, VirtualMachine, NS)
    • --cluster-scope (valid: All or name[:uid][,name2[:uid2]...])
    • --include-filter (provide a simple prefix/substring; regex like .* is not required. Example: use daily- to match daily-backup. Use * to match all within the specified scope)
  • Mutual exclusivity:
    • Do not specify both --include-objects and --include-filter
    • Do not specify both --exclude-objects and --exclude-filter
    • Do not specify both --include-filter and --exclude-filter
  • Do not mix single-mode flags (--name, --uid) with bulk-mode flags.
  • Bulk UID Check Relaxation: By default, bulk operations require UIDs for object references (e.g., --include-objects, --exclude-objects, --policy-refs). Use --bulk-uid-check-relaxation to allow name-only references when you accept the potential side effects of matching multiple objects with the same name across different organizations or contexts. This is particularly useful when filtering by policy references without looking up UIDs.

Output Format Support

  • --output table (default)
  • --output json
  • --output yaml
  • --output name (for get)

Authentication and Context

  • Organization ID from context
  • Authentication token from context
  • Labels from context