Jetson/FAQ/BSP/RootFS Reduction

= How to reduce disk usage on Jetson platform =

Jetson platform files system is based on ubuntu sample file system. Some Nvidia platform related binaries (BSP related) are added to support platform basic function. Jetson SDK Components including CUDA, cuDNN, TensorRT, OpenCV, VisionWorks, DeepStream and multimedia API provide AI related support.

This page breaks down Nvidia platform related binaries and Jetson SDK Component, so user can remove unused files to save space. A command to list all installed ubuntu packages by size is also provided for user to remove unused package based on needs.

Nvidia platform related binaries breakdown
Below is a breakdown of Nvidia platform related binaries.

/ ├── boot (43M)           Image(kernel binary), dtb and extlinux.conf. All are not used by Xavier, Image and extlinux.conf are used by Nano, TX1 and TX2 ├── etc (536K)          Nvidia specified config file. DO NOT touch ├── lib │   ├── firmware (4.3M) Firmwares used by platform. DO NOT touch │   ├── modules (47M)   Modules(.ko) used by platform. Can delete some based on needs │   └── systemd (32K)   Nvidia specified config file. DO NOT touch ├── opt │   └── nvidia (17M)    Jetson gpio python lib and usb device mode service. Can delete based on needs ├── usr │   ├── bin (356K)      Nvidia speficied tools. DO NOT touch │   ├── lib (130M)      Nvidia speficied libs. DO NOT touch │   ├── sbin (2M)       Nvidia speficied tools. DO NOT touch │   ├── share (2.5M)    Nvidia specified boot logo, license, icon, etc. DO NOT touch │   └── src (234M)      Linux header files and grahics demos. Can delete based on needs └── var └── nvidia (188K)   Placeholder for nvcam. Can delete based on needs

Jetson SDK Components
Based on Jetson OS, Jetson SDK Components, including CUDA, cuDNN, TensorRT, OpenCV, VisionWorks, MultiMedia API and DeepStream, are installed by sdkmanager(or jetpack tool for older version). MultiMedia API is installed by tbz2 package while others are installed by deb package.

Both Jetson SDK libs(both static and dynamic libs) and sample code are installed and sample code can be deleted to save space. And if user's application is dynamicly linked to these libs, all static libs can be deleted.

After Jetson SDK Components are installed, run below commands can remove all deb files. sudo apt clean   # clean debs in /var/cache/apt/archives sudo rm /etc/apt/sources.list.d/*       # remove /var/cudaxxxx, /var/visonworksxxxx from apt source list sudo rm /var/cuda-repo-10-0-local-10.0.326/ /var/visionworks-repo/ /var/visionworks-sfm-repo/ /var/visionworks-tracking-repo/ -rf    # remove nvidia's debs

Below table list all Jetson SDK Components brief breakdown.

Remove installed deb packages
Run below command can remove all cached .deb file. sudo apt clean Run below command can remove all non-required installed packages. sudo apt autoremove Below command can list all install deb packages by size. User can remove the undesired packages by hand to save space. dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rn

= Example =

Remove all deb installation packages
sudo apt clean sudo rm /etc/apt/sources.list.d/* sudo rm -rf /var/cuda-repo-10-0-local-10.0.326/ /var/visionworks-repo/ /var/visionworks-sfm-repo/ /var/visionworks-tracking-repo

Remove ubuntu-desktop and the accessories
sudo apt-get purge gnome-shell sudo apt-get purge docker* sudo apt-get purge chromium-browser thunderbird fonts-noto-cjk libreoffice-common  containerd  snapd sudo apt-get remove --purge python* libpython* sudo apt-get purge libwebkit2gtk-4.0-37 libqt5webkit5  ubuntu-wallpapers-bionic freepats  libreoffice-writer libicu60  libreoffice-calc vim-runtime libflite1  libperl5.26 libmozjs-52-0 humanity-icon-theme samba-libs  iso-codes kwin-data perl-modules-5.26 light-themes libjavascriptcoregtk-4.0-18 chromium-browser-l10n sudo apt-get purge libvisionworks libvisionworks-sfm-dev libvisionworks-sfm-repo sudo apt-get autoremove

Remove some source code and sample code
cd /usr/src && sudo rm -rf cudnn_samples_v7 linux-headers-4.9.140-tegra-ubuntu18.04_aarch64 linux-headers-4.9.140-tegra-linux_x86_64 tensorrt nvidia rm -rf /home/nvidia/VisionWorks-SFM-0.90-Samples