|
| 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 for storing a persistent cache of image blobs and manifests. You can use this cache directory to perform incremental mirroring and avoid remirroring unchanged images, which saves time and reduces network bandwidth usage. |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +You can use the `--workspace` flag to specify a directory for storing the working files that are created during a mirroring operation, such as the `ImageDigestMirrorSet` and `ImageTagMirrorSet` manifests. You can use this workspace directory to apply the generated configuration to clusters and repeat mirroring operations. |
| 14 | + |
| 15 | +If you remove or modify the workspace directory, future mirroring operations might fail, or clusters may use inconsistent image sources. |
| 16 | + |
| 17 | +[WARNING] |
| 18 | +==== |
| 19 | +Deleting or modifying the contents of cache or workspace directories can cause the following issues: |
| 20 | +
|
| 21 | +* Failed or incomplete mirroring operations. |
| 22 | +* Loss of incremental mirroring data. |
| 23 | +* Full remirroring requirements and increased network overhead. |
| 24 | +
|
| 25 | +Do not modify, relocate, or delete these directori es unless you fully understand the impact. You must regularly back up the cache and workspace directories after successful mirroring operations. |
| 26 | +==== |
| 27 | + |
| 28 | +The following best practices help you manage the cache and workspace directories effectively: |
| 29 | + |
| 30 | +* Use persistent storage: Place the cache and workspace directories on reliable and backed‑up storage. |
| 31 | +* Back up after successful operations: Regularly back up both directories, especially after completing a mirroring cycle. |
| 32 | +* Restore when needed: In case of data loss, restore these directories from backup to resume mirroring operations without performing a full remirror. |
| 33 | +* Separate environments: Use dedicated directories for different environments to prevent conflicts. |
| 34 | +
|
| 35 | +.Example: Using cache and workspace directories |
| 36 | +==== |
| 37 | +Specify the cache and workspace directories by running the following command: |
| 38 | +[source,terminal] |
| 39 | +---- |
| 40 | +$ oc mirror --config=imageset-config.yaml \ |
| 41 | + file://local_mirror \ |
| 42 | + --workspace /mnt/mirror-data/workspace \ |
| 43 | + --cache-dir /mnt/mirror-data/cache |
| 44 | + --v2 |
| 45 | +---- |
| 46 | +
|
| 47 | +Example directory structure after mirroring: |
| 48 | +---- |
| 49 | +/mnt/mirror-data/ |
| 50 | +├── cache/ |
| 51 | +│ ├── manifests/ |
| 52 | +│ ├── metadata.db |
| 53 | +│ └── previous-mirror-state.json |
| 54 | +└── workspace/ |
| 55 | + ├── imageset-config-state.yaml |
| 56 | + ├── manifests/ |
| 57 | + └── icsp/ |
| 58 | +---- |
| 59 | +
|
| 60 | +You must back up both `/mnt/mirror-data/cache` and `/mnt/mirror-data/workspace` directories after each successful mirroring operation. |
| 61 | +==== |
| 62 | + |
0 commit comments