diff options
| author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2023-08-11 11:03:40 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-08-30 15:54:59 +0100 |
| commit | dabc3dc087217c514d70c48d4fb083652f5fcf27 (patch) | |
| tree | c9dced41d6511683f97660db4761d31b41c19361 | |
| parent | 9bf8250a403e046a0cbd4bea7113b03b33b27cc0 (diff) | |
| download | poky-dabc3dc087217c514d70c48d4fb083652f5fcf27.tar.gz | |
dev-manual: disk-space: mention faster "find" command to trim sstate cache
[YOCTO #15182]
(From yocto-docs rev: 6fd067639e7d6ae87bda9ea8795ebf54b8827056)
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Reported-by: Yoann CONGAL <yoann.congal@smile.fr>
Reported-by: Randy MacLeod <randy.macleod@windriver.com>
Reported-by: Josef Holzmayr <jester@theyoctojester.info>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | documentation/dev-manual/disk-space.rst | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/documentation/dev-manual/disk-space.rst b/documentation/dev-manual/disk-space.rst index c63591cc7a..a84bef4511 100644 --- a/documentation/dev-manual/disk-space.rst +++ b/documentation/dev-manual/disk-space.rst | |||
| @@ -27,19 +27,35 @@ Purging Duplicate Shared State Cache Files | |||
| 27 | ========================================== | 27 | ========================================== |
| 28 | 28 | ||
| 29 | After multiple build iterations, the Shared State (sstate) cache can contain | 29 | After multiple build iterations, the Shared State (sstate) cache can contain |
| 30 | duplicate cache files for a given package, while only the most recent one | 30 | duplicate cache files for a given package, consuming a substantial amount of |
| 31 | is likely to be reusable. The following command purges all but the | 31 | disk space. However, only the most recent cache files are likeky to be reusable. |
| 32 | newest sstate cache file for each package:: | ||
| 33 | 32 | ||
| 34 | sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache | 33 | The following command is a quick way to purge all the cache files which |
| 34 | haven't been used for a least a specified number of days:: | ||
| 35 | 35 | ||
| 36 | This command will ask you to confirm the deletions it identifies. | 36 | find build/sstate-cache -type f -mtime +$DAYS -delete |
| 37 | 37 | ||
| 38 | .. note:: | 38 | The above command relies on the fact that BitBake touches the sstate cache |
| 39 | files as it accesses them, when it has write access to the cache. | ||
| 39 | 40 | ||
| 40 | The duplicated sstate cache files of one package must have the same | 41 | You could use ``-atime`` instead of ``-mtime`` if the partition isn't mounted |
| 41 | architecture, which means that sstate cache files with multiple | 42 | with the ``noatime`` option for a read only cache. |
| 42 | architectures are not considered as duplicate. | ||
| 43 | 43 | ||
| 44 | For more advanced needs, OpenEmbedded-Core also offers a more elaborate | ||
| 45 | command. It has the ability to purge all but the newest cache files on each | ||
| 46 | architecture, and also to remove files that it considers unreachable by | ||
| 47 | exploring a set of build configurations. However, this command | ||
| 48 | requires a full build environment to be available and doesn't work well | ||
| 49 | covering multiple releases. It won't work either on limited environments | ||
| 50 | such as BSD based NAS:: | ||
| 51 | |||
| 52 | sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache | ||
| 53 | |||
| 54 | This command will ask you to confirm the deletions it identifies. | ||
| 44 | Run ``sstate-cache-management.sh`` for more details about this script. | 55 | Run ``sstate-cache-management.sh`` for more details about this script. |
| 45 | 56 | ||
| 57 | .. note:: | ||
| 58 | |||
| 59 | As this command is much more cautious and selective, removing only cache files, | ||
| 60 | it will execute much slower than the simple ``find`` command described above. | ||
| 61 | Therefore, it may not be your best option to trim huge cache directories. | ||
