diff options
Diffstat (limited to 'documentation/dev-manual/disk-space.rst')
-rw-r--r-- | documentation/dev-manual/disk-space.rst | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/documentation/dev-manual/disk-space.rst b/documentation/dev-manual/disk-space.rst new file mode 100644 index 0000000000..efca82601d --- /dev/null +++ b/documentation/dev-manual/disk-space.rst | |||
@@ -0,0 +1,61 @@ | |||
1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK | ||
2 | |||
3 | Conserving Disk Space | ||
4 | ********************* | ||
5 | |||
6 | Conserving Disk Space During Builds | ||
7 | =================================== | ||
8 | |||
9 | To help conserve disk space during builds, you can add the following | ||
10 | statement to your project's ``local.conf`` configuration file found in | ||
11 | the :term:`Build Directory`:: | ||
12 | |||
13 | INHERIT += "rm_work" | ||
14 | |||
15 | Adding this statement deletes the work directory used for | ||
16 | building a recipe once the recipe is built. For more information on | ||
17 | "rm_work", see the :ref:`ref-classes-rm-work` class in the | ||
18 | Yocto Project Reference Manual. | ||
19 | |||
20 | When you inherit this class and build a ``core-image-sato`` image for a | ||
21 | ``qemux86-64`` machine from an Ubuntu 22.04 x86-64 system, you end up with a | ||
22 | final disk usage of 22 Gbytes instead of &MIN_DISK_SPACE; Gbytes. However, | ||
23 | &MIN_DISK_SPACE_RM_WORK; Gbytes of initial free disk space are still needed to | ||
24 | create temporary files before they can be deleted. | ||
25 | |||
26 | Purging Obsolete Shared State Cache Files | ||
27 | ========================================= | ||
28 | |||
29 | After multiple build iterations, the Shared State (sstate) cache can contain | ||
30 | multiple cache files for a given package, consuming a substantial amount of | ||
31 | disk space. However, only the most recent ones are likely to be reused. | ||
32 | |||
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 | |||
36 | find build/sstate-cache -type f -mtime +$DAYS -delete | ||
37 | |||
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. | ||
40 | |||
41 | You could use ``-atime`` instead of ``-mtime`` if the partition isn't mounted | ||
42 | with the ``noatime`` option for a read only cache. | ||
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.py --remove-duplicated --cache-dir=sstate-cache | ||
53 | |||
54 | This command will ask you to confirm the deletions it identifies. | ||
55 | Run ``sstate-cache-management.sh`` for more details about this script. | ||
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. | ||