diff options
author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2023-08-11 11:03:40 +0200 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-09-13 06:21:26 -1000 |
commit | 2bd4e2392b89c97006d29795ad2bd59d2227f5d4 (patch) | |
tree | d224d92888e2767c4115f81b338d507aa7324e26 /documentation | |
parent | 1c54f85cf94919a56cb2a106d8931f2e3dea160c (diff) | |
download | poky-2bd4e2392b89c97006d29795ad2bd59d2227f5d4.tar.gz |
dev-manual: disk-space: mention faster "find" command to trim sstate cache
[YOCTO #15182]
(From yocto-docs rev: 0bcd2ca98870f4d5bb8c2677fda260da548787d6)
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>
Diffstat (limited to 'documentation')
-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. | ||