Robotics

Minimizing Storage Usage on Jetson

NVIDIA Jetson provides flexible storage options/configurations for development, but some of the Jetson modules are equipped with a limited eMMC flash memory storage size for more cost-conscious, large-scale product deployment.

It may initially seem impossible to fit your applications and necessary libraries in the limited storage space, especially with the full set of NVIDIA JetPack, BSP, and all the development software that NVIDIA has prepackaged for Jetson.

NVIDIA JetPack 5.0.1 DP (Rel 34.1.1)
NVIDIA Jetson AGX Orin Developer Kit
NVIDIA JetPack 4.6.2 (Rel 32.7.2)
NVIDIA Jetson AGX Xavier Developer Kit
NVIDIA JetPack 4.6.1 (Rel 32.7.1)
NVIDIA Jetson Xavier NX Developer Kit
(Original) Regular L4T ([a])6.1 GB5.5 GB 
(Original) Full JetPack ([A])16.6 GB11.6 GB11.6 GB
Table 1. Disk usage in the original configurations

However, you can cut down on disk usage by removing unnecessary packages, libraries, and other assets. Table 2 shows how you can reclaim more than 8 GB of storage space on some of the latest NVIDIA JetPack versions.

NVIDIA JetPack 5.0.1 DP (Rel 34.1.1)
NVIDIA Jetson AGX Orin Developer Kit
NVIDIA JetPack 4.6.2 (Rel 32.7.2)
NVIDIA Jetson AGX Xavier Developer Kit
NVIDIA JetPack 4.6.1 (Rel 32.7.1)
NVIDIA Jetson Xavier NX Developer Kit
Example deployment configuration ([D])8.3 GB5.2 GB5.3 GB
Table 2. Disk usage in an optimized deployment configuration

In this post, I present simplified steps to minimize the disk usage on your Jetson device, while sharing tips on ways to analyze disk usage, actual commands, and the example outputs on different versions of JetPack. I also show how to check if an AI application is still working functionally under the slimmed-down configuration.

Identifying what takes up space

The jetson-min-disk documentation shows how to analyze the current disk usage, identify what files and directories take up the space, and clarify the package dependencies. It also shows example command outputs on NVIDIA JetPack 4.6.x and NVIDIA JetPack 5.0.x, so that you can assess how much you may be able to cut down for your application.

Minimized configurations

Figure 1 shows an overview of the minimal configurations. The jetson-min-disk documentation introduces multiple configurations ([A] to [D]) for different development and productization needs.

Overview of the minimal configurations.
Figure 1. Different minimal configurations

You can take the following actions to regain disk space.

  • Remove the desktop user interface.
  • Remove the documentation and samples package.
  • Remove dev packages.

Remove the desktop graphical user interface

You can remove ubuntu-desktop if you know your system does not require a graphical user interface on the NVIDIA Jetson native display output through HDMI, DP/eDP, or LVDS. For more information, see Removing GUI.

NVIDIA JetPack 5.0.1 DP (Rel 34.1.1)
NVIDIA Jetson AGX Orin Developer Kit
NVIDIA JetPack 4.6.2 (Rel 32.7.2)
NVIDIA Jetson AGX Xavier Developer Kit
NVIDIA JetPack 4.6.1 (Rel 32.7.1)
NVIDIA Jetson Xavier NX Developer Kit
Removing the graphical user interface3.4 GB5.5 GB4.2 GB
Table 3. Disk space regained in a typical setup by removing the desktop graphical user interface.
$ sudo apt-get update
$ sudo apt-get purge $(cat apt-packages-only-in-full.txt)
$ sudo apt-get install network-manager
$ sudo reboot

Remove the documentation and samples package

If you have installed the full set of JetPack components (libraries and SDKs) either with the sudo apt install nvidia-jetpack command or by using SDK Manager to install all, you may have packages that you do not need for your application.

Documentation and samples packages are some of the safest to remove, so you can start by uninstalling them. For more information, see Removing docs/sample.

NVIDIA JetPack 5.0.1 DP (Rel 34.1.1)
NVIDIA Jetson AGX Orin Developer Kit
NVIDIA JetPack 4.6.2 (Rel 32.7.2)
NVIDIA Jetson AGX Xavier Developer Kit
NVIDIA JetPack 4.6.1 (Rel 32.7.1)
NVIDIA Jetson Xavier NX Developer Kit
Removing docs and samples0.8 GB1.2 GB1.1 GB
Table 4. Disk space regained in a typical setup by removing documentation and sample packages
$ sudo dpkg -r --force-depends "cuda-documentation-10-2" "cuda-samples-10-2" "libnvinfer-samples" "libvisionworks-samples" "libnvinfer-doc" "vpi1-samples"

Remove dev packages and static libraries

When you are done with building your applications, you do not need dev packages that provide header files and static libraries. You can remove them after checking how much disk space each package takes up. For more information, see Removing dev packages.

NVIDIA JetPack 5.0.1 DP (Rel 34.1.1)
NVIDIA Jetson AGX Orin Developer Kit
NVIDIA JetPack 4.6.2 (Rel 32.7.2)
NVIDIA Jetson AGX Xavier Developer Kit
NVIDIA JetPack 4.6.1 (Rel 32.7.1)
NVIDIA Jetson Xavier NX Developer Kit
Removing static libraries4.8 GB2.1 GB2.2 GB
Table 5. Disk space regained in a typical setup by removing dev packages
$ sudo dpkg -r --force-depends $(dpkg-query -Wf '${Package}\n' | grep -E "(cuda[^ ]+dev|libcu[^ ]+dev|libnv[^ ]+dev|vpi[^ ]+dev)")

Starting with minimal L4T BSP

If you are using a host x86-64 Linux host machine to flash your Jetson, you can create a minimal configuration RootFS and flash that image onto Jetson.

For more information about building the minimal L4T RooFS image, see Option: Minimal L4T.

Verification

The guide introduces ways to use the NVIDIA DeepStream reference app as a typical AI application to verify the minimally configured Jetson environment. For more information, see Verification.

git clone https://github.com/NVIDIA-AI-IOT/jetson-min-disk/
cd jetson-min-disk
cd test-docker
./docker-run-deepstream-app-overlay.sh
GIF shows images of traffic and code
Figure 2. DeepStream reference app with overlay output config in action

Conclusion

In this post, I demonstrated ways to work within NVIDIA Jetson storage space limitations while identifying and keeping the essential runtime libraries for AI applications.

The documentation cross-referenced in this post provides commands and tips for different NVIDIA JetPack versions. They can be great tools if you are interested in optimizing the storage usage, especially on NVIDIA Jetson production modules.

Discuss (8)

Tags