|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * installing/disconnected_install/installing-mirroring-disconnected-v2.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: CONCEPT |
| 6 | +[id="oc-mirror-about-cache-and-workspace-dirs_{context}"] |
| 7 | += About the --cache-dir and --workspace flags |
| 8 | + |
| 9 | +You can use the `--cache-dir` flag to specify a directory where the oc-mirror plugin stores a persistent cache of image blobs and manifests for use during mirroring operations. |
| 10 | + |
| 11 | +The oc-mirror plugin uses the cache in the `disk-to-mirror` and `mirror-to-disk` workflows but does not use the cache in the `mirror-to-mirror` workflow. The plugin uses the cache to perform incremental mirroring and avoids remirroring unchanged images, which saves time and reduces network bandwidth usage. |
| 12 | + |
| 13 | +The cache directory only contains data up to the last successful mirroring operation. If you delete or corrupt the cache directory, the oc-mirror plugin pulls the image blobs and manifests again, which can force a full remirror and increase network usage. |
| 14 | + |
| 15 | +// You can use the --workspace flag to specify a directory where the oc-mirror plugin stores the working files it creates during a mirroring operation, such as the ImageDigestMirrorSet and ImageTagMirrorSet manifests. |
| 16 | + |
| 17 | +You can use the `--workspace` flag to specify a directory where the oc-mirror plugin stores the working files that it creates during a mirroring operation, such as the `ImageDigestMirrorSet` and `ImageTagMirrorSet` manifests. You can also use the workspace directory to perform the following actions: |
| 18 | + |
| 19 | +* Store the untarred metadata for release and operator images. |
| 20 | +* Generate tar archives for use in `disk-to-mirror` workflows. |
| 21 | +* Apply the generated configuration to clusters. |
| 22 | +* Repeat or resume previous mirroring operations. |
| 23 | +
|
| 24 | +If you remove or modify the workspace directory, future mirroring operations might fail, or clusters may use inconsistent image sources. |
| 25 | + |
| 26 | +[WARNING] |
| 27 | +==== |
| 28 | +Deleting or modifying the contents of cache or workspace directories can cause the following issues: |
| 29 | +
|
| 30 | +* Failed or incomplete mirroring operations. |
| 31 | +* Loss of incremental mirroring data. |
| 32 | +* Full remirroring requirements and increased network overhead. |
| 33 | +
|
| 34 | +Do not modify, relocate, or delete these directories unless you fully understand the impact. You must regularly back up the cache directory after successful mirroring operations. It is not necessary to back up the workspace directory because its contents are regenerated during each mirroring cycle. |
| 35 | +==== |
| 36 | + |
| 37 | +The following best practices help you manage the cache and workspace directories effectively: |
| 38 | + |
| 39 | +* Use persistent storage: Place the cache and workspace directories on reliable and backed‑up storage. |
| 40 | +* Back up after successful operations: Regularly back up the cache directory, especially after completing a mirroring cycle. |
| 41 | +* Restore when needed: In case of data loss, restore the cache and workspace directories from backup to resume mirroring operations without performing a full remirror. |
| 42 | +* Separate environments: Use dedicated directories for different environments to prevent conflicts. |
| 43 | +
|
| 44 | +.Using cache and workspace directories |
| 45 | +==== |
| 46 | +Specify the cache and workspace directories by running the following command: |
| 47 | +[source,terminal] |
| 48 | +---- |
| 49 | +$ oc mirror --config=imageset-config.yaml \ |
| 50 | + file://local_mirror \ |
| 51 | + --workspace /mnt/mirror-data/workspace \ |
| 52 | + --cache-dir /mnt/mirror-data/cache |
| 53 | + --v2 |
| 54 | +---- |
| 55 | +
|
| 56 | +Example directory structure after mirroring: |
| 57 | +---- |
| 58 | +/mnt/mirror-data/ |
| 59 | +├── cache/ |
| 60 | +│ ├── manifests/ |
| 61 | +│ ├── metadata.db |
| 62 | +│ └── previous-mirror-state.json |
| 63 | +└── workspace/ |
| 64 | + ├── imageset-config-state.yaml |
| 65 | + ├── manifests/ |
| 66 | + └── icsp/ |
| 67 | +---- |
| 68 | +
|
| 69 | +You must back up the `/mnt/mirror-data/cache` directory after each successful mirroring operation. |
| 70 | +==== |
| 71 | + |
0 commit comments