Chapter 1. Backing up and restoring MicroShift data


To back up and restore MicroShift data manually, you can use the backup and restore procedures for the database on all supported systems. For application data, you must define your own backup and restore steps.

Note

Only MicroShift data is backed up with the following procedures. Application data is not included.

  • On rpm-ostree systems, MicroShift automatically creates a backup on every start. These automatic backups are deleted and replaced with the latest backup each time the system restarts.
  • If you are using an rpm-ostree system, the data is automatically restored after greenboot rolls the system back. This data restoration ensures that the database matches the software running on the host after the rollback is completed.
  • On other system types, you must back up and restore data manually.

1.1. Stopping the MicroShift service

To stop the MicroShift service, you can run systemctl stop microshift. You can also stop any deployed workloads by running systemctl stop kubepods.slice.

Prerequisites

  • The MicroShift service is running.

Procedure

  1. Enter the following command to stop the MicroShift service:

    $ sudo systemctl stop microshift
    Copy to Clipboard Toggle word wrap
  2. Workloads deployed on MicroShift might continue running even after the MicroShift service has been stopped. Enter the following command to display running workloads:

    $ sudo crictl ps -a
    Copy to Clipboard Toggle word wrap
  3. Enter the following commands to stop the deployed workloads:

    $ sudo systemctl stop kubepods.slice
    Copy to Clipboard Toggle word wrap

1.2. Backing up MicroShift data manually

To back up Red Hat build of MicroShift data manually, you can run microshift backup with a full path to the backup location. Stop the service first and use the entire path for the output file or directory.

You can back up MicroShift data manually at any time. Back up your data before system updates to preserve it for use if an update fails or for other system trouble. You can use the /var/lib/microshift-backups for manually backing up and restoring data by specifying it in each command.

Prerequisites

  • You have root access to the host.
  • MicroShift is stopped.

Procedure

  1. Manually create a backup by using the parent directory and specifying a name, such as /var/lib/microshift-backups/<my_manual_backup>, by running the following command:

    $ sudo microshift backup /var/lib/microshift-backups/<my_manual_backup>
    Copy to Clipboard Toggle word wrap
    • For <manual_backup>, specify the backup name that you want to use.

      Example output

      ??? I1017 07:38:16.770506    5900 data_manager.go:92] "Copying data to backup directory" storage="/var/lib/microshift-backups" name="test" data="/var/lib/microshift"
      ??? I1017 07:38:16.770713    5900 data_manager.go:227] "Starting copy" cmd="/bin/cp --verbose --recursive --preserve --reflink=auto /var/lib/microshift /var/lib/microshift-backups/test"
      ??? I1017 07:38:16.776162    5900 data_manager.go:241] "Finished copy" cmd="/bin/cp --verbose --recursive --preserve --reflink=auto /var/lib/microshift /var/lib/microshift-backups/test"
      ??? I1017 07:38:16.776256    5900 data_manager.go:125] "Copied data to backup directory" backup="/var/lib/microshift-backups/test" data="/var/lib/microshift"
      Copy to Clipboard Toggle word wrap

  2. Optional: Manually create a backup in a specific parent directory with a custom name by running the following command:

    $ sudo microshift backup /mnt/<other_backups_location>/<another_manual_backup>
    Copy to Clipboard Toggle word wrap
    • For <other_backups_location>, specify the directory that you want to use.
    • For <another_manual_backup>, specify the backup name that you want to use.

Verification

  • You can verify that the backup exists by viewing the data in the directory you chose. For example, /var/lib/microshift-backups/<my_manual_backup>/ or /mnt/<other_backups_location>/<another_manual_backup>.

1.3. Restoring MicroShift data backups manually

To restore Red Hat build of MicroShift data after an update or data loss, you can run microshift restore with the full path to the backup. Backups can be restored after updates, or after other system events that remove or damage required data. When you restore a backup, you must use the entire file path.

Note

On an rpm-ostree system, MicroShift backs up and restores data automatically.

Prerequisites

  • Root access to the host.
  • Full path of the data backup file.
  • The MicroShift service is stopped.

Procedure

  1. Manually restore MicroShift data by using the full file path of the backup you want to restore by running the following command:

    $ sudo microshift restore /var/lib/microshift-backups/<my_manual_backup>
    Copy to Clipboard Toggle word wrap
    • For <my_manual_backup>, specify the backup name that you want to use. Optionally, you can also restore automatic ostree backups using the full file path.

      Example output

      ??? I1017 07:39:52.055165    6007 data_manager.go:131] "Copying backup to data directory" storage="/var/lib/microshift-backups" name="test" data="/var/lib/microshift"
      ??? I1017 07:39:52.055243    6007 data_manager.go:154] "Renaming existing data dir" data="/var/lib/microshift" renamedTo="/var/lib/microshift.saved"
      ??? I1017 07:39:52.055326    6007 data_manager.go:227] "Starting copy" cmd="/bin/cp --verbose --recursive --preserve --reflink=auto /var/lib/microshift-backups/test /var/lib/microshift"
      ??? I1017 07:39:52.061363    6007 data_manager.go:241] "Finished copy" cmd="/bin/cp --verbose --recursive --preserve --reflink=auto /var/lib/microshift-backups/test /var/lib/microshift"
      ??? I1017 07:39:52.061404    6007 data_manager.go:175] "Removing temporary data directory" path="/var/lib/microshift.saved"
      ??? I1017 07:39:52.063745    6007 data_manager.go:180] "Copied backup to data directory" name="test" data="/var/lib/microshift"
      Copy to Clipboard Toggle word wrap

  2. Optional. Manually restore data from a customized directory by using the full file path of the backup. Run the following command:

    $ sudo microshift restore /<mnt>/<other_backups_location>/<another_manual_backup>
    Copy to Clipboard Toggle word wrap
    • For <other_backups_location>, specify the directory that you used.
    • For <another_manual_backup>, specify the backup name that you used.
  3. Restart the host. Restarting the host enables all workloads and pods to restart.

Verification

  • Use the oc get pods -A command to verify that the node is running, then check the restored data.

    $ oc get pods -A
    Copy to Clipboard Toggle word wrap

    Example output

    NAMESPACE                   NAME                                                     READY   STATUS   RESTARTS  AGE
    default                     i-06166fbb376f14a8bus-west-2computeinternal-debug-qtwcr  1/1     Running  0		    46m
    kube-system                 csi-snapshot-controller-5c6586d546-lprv4                 1/1     Running  0		    51m
    kube-system                 csi-snapshot-webhook-6bf8ddc7f5-kz6k9                    1/1     Running  0		    51m
    openshift-dns               dns-default-45jl7                                        2/2     Running  0		    50m
    openshift-dns               node-resolver-7wmzf                                      1/1     Running  0		    51m
    openshift-ingress           router-default-78b86fbf9d-qvj9s                          1/1     Running  0		    51m
    openshift-ovn-kubernetes    ovnkube-master-5rfhh                                     4/4     Running  0		    51m
    openshift-ovn-kubernetes    ovnkube-node-gcnt6                                       1/1     Running  0		    51m
    openshift-service-ca        service-ca-bf5b7c9f8-pn6rk                               1/1     Running  0		    51m
    openshift-storage           topolvm-controller-549f7fbdd5-7vrmv                      5/5     Running  0		    51m
    openshift-storage           topolvm-node-rht2m                                       3/3     Running  0		    50m
    Copy to Clipboard Toggle word wrap

    Note

    This example output shows a basic MicroShift installation. If you installed optional RPMs, the status of pods running those services is also expected in your output.

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る