diff options
| author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2023-09-08 09:37:58 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-09-18 04:28:04 -1000 |
| commit | 5c556073ac6e54314aa3fc210db040f3ab55105a (patch) | |
| tree | 218b2c95b61bd45fabe449da31a6a62914e2a346 | |
| parent | ad9420b072896b6a58a571c8123bcb17a813a1e7 (diff) | |
| download | poky-5c556073ac6e54314aa3fc210db040f3ab55105a.tar.gz | |
dev-manual: common-tasks: mention faster "find" command to trim sstate cache
[YOCTO #15182]
(From yocto-docs rev: dd778676c946faa8702e8fcc9126ad9537e7a21e)
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: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | documentation/dev-manual/common-tasks.rst | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst index 6a527f0ef8..a2404e5f4e 100644 --- a/documentation/dev-manual/common-tasks.rst +++ b/documentation/dev-manual/common-tasks.rst | |||
| @@ -6511,25 +6511,42 @@ building a recipe once the recipe is built. For more information on | |||
| 6511 | Yocto Project Reference Manual. | 6511 | Yocto Project Reference Manual. |
| 6512 | 6512 | ||
| 6513 | Purging Duplicate Shared State Cache Files | 6513 | Purging Duplicate Shared State Cache Files |
| 6514 | ------------------------------------------- | 6514 | ------------------------------------------ |
| 6515 | 6515 | ||
| 6516 | After multiple build iterations, the Shared State (sstate) cache can contain | 6516 | After multiple build iterations, the Shared State (sstate) cache can contain |
| 6517 | duplicate cache files for a given package, while only the most recent one | 6517 | duplicate cache files for a given package, consuming a substantial amount of |
| 6518 | is likely to be reusable. The following command purges all but the | 6518 | disk space. However, only the most recent cache files are likeky to be reusable. |
| 6519 | newest sstate cache file for each package:: | ||
| 6520 | 6519 | ||
| 6521 | sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache | 6520 | The following command is a quick way to purge all the cache files which |
| 6521 | haven't been used for a least a specified number of days:: | ||
| 6522 | 6522 | ||
| 6523 | This command will ask you to confirm the deletions it identifies. | 6523 | find build/sstate-cache -type f -mtime +$DAYS -delete |
| 6524 | |||
| 6525 | The above command relies on the fact that BitBake touches the sstate cache | ||
| 6526 | files as it accesses them, when it has write access to the cache. | ||
| 6527 | |||
| 6528 | You could use ``-atime`` instead of ``-mtime`` if the partition isn't mounted | ||
| 6529 | with the ``noatime`` option for a read only cache. | ||
| 6524 | 6530 | ||
| 6525 | Note:: | 6531 | For more advanced needs, OpenEmbedded-Core also offers a more elaborate |
| 6532 | command. It has the ability to purge all but the newest cache files on each | ||
| 6533 | architecture, and also to remove files that it considers unreachable by | ||
| 6534 | exploring a set of build configurations. However, this command | ||
| 6535 | requires a full build environment to be available and doesn't work well | ||
| 6536 | covering multiple releases. It won't work either on limited environments | ||
| 6537 | such as BSD based NAS:: | ||
| 6526 | 6538 | ||
| 6527 | The duplicated sstate cache files of one package must have the same | 6539 | sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache |
| 6528 | architecture, which means that sstate cache files with multiple | ||
| 6529 | architectures are not considered as duplicate. | ||
| 6530 | 6540 | ||
| 6541 | This command will ask you to confirm the deletions it identifies. | ||
| 6531 | Run ``sstate-cache-management.sh`` for more details about this script. | 6542 | Run ``sstate-cache-management.sh`` for more details about this script. |
| 6532 | 6543 | ||
| 6544 | .. note:: | ||
| 6545 | |||
| 6546 | As this command is much more cautious and selective, removing only cache files, | ||
| 6547 | it will execute much slower than the simple ``find`` command described above. | ||
| 6548 | Therefore, it may not be your best option to trim huge cache directories. | ||
| 6549 | |||
| 6533 | Working with Packages | 6550 | Working with Packages |
| 6534 | ===================== | 6551 | ===================== |
| 6535 | 6552 | ||
