Jetpack 4.2.3 has a built in 2GB swap file we are not able to increase this to 4 GB

We have installed Jetpack 4.2.3 on jetson nano. This has created a 2GB bulit in swap memory. We want to increase this. How is it done?

The 2GB swap memory that it created by default is zram, so it uses compression to store pages in memory. It is recommended to keep the zram-to-memory ratio at 1:2 (i.e. 1/2 of RAM). However, you could edit this behavior in the startup script found at /etc/systemd/, or by manually using mkswap/swapon with the /dev/zram* files (which is what the nvzramconfig script does internally).

If you require more swap, you may want to mount additional disk-based swap instead of zram, like on an SSD for example. To do that, you can follow this guide for mounting a swap file:

1 Like

How can we remove zram completely and add swap file?

Hi razackkpa,

There is a convenient script here that you can use for reference:, its usage is explained in:

You don’t need to remove zram to add a swap file. Just follow dusty_nv’s link to install a normal swap partition in addition. If security is a priorty, to add a new encrypted swap file, please follow these instructions after installing cryptsetup with sudo apt install cryptsetup:

An unencrypted swap file will perform very slightly better, but there are security risks associated, especially if the disk on which the swap partition is located is removable (eg. sd card or external ssd).

We have added swap file following instruction from
Its working fine with older version of jetpack. Jetpack 4.2.3 has a built in 2GB zram and if we create swap the priority is still zram. As you suggested we do not need to remove zram. Please tell us how to prioritize swap so that the system takes swap before taking zram.
Any help possible?

Disabled zram by removing from /etc/systemd/ and zram is not invoked when the system boots

If you Google, you can find how to set swap priority. you can check what the priority is with the swapon command and set it persistently with a mount option in /etc/fstab. Fwiw you might not want to prioritize disk swap over zram because disk swap is going to be slower.

You should be able to just use systemctl to disable the unit rather than delete the script. The systemctl command will list all units. You should be able to find the zram service easily in the list (or grep for it) and then just “systemctl disable servicenamehere”

@mdegans Your generalized ‘half of the puzzle techie reply’ is not a (straightforward) answer: you do make any upcoming readers/repliers feel rather uneasy. Normally I would fully agree to use the systemctl command. In addition, you do know at this point you make several assumptions that there is a service available… so which one is it… see list below.

@razackkpa Thank you for your answer and straightforward solution!

Use the following command line to list all available “services”: systemctl list-units

These are currently available on my Jetson Nano node:

alsa-restore.service                                                                                                                  loaded active exited    Save/Restore Sound Card State                                                                             
apport.service                                                                                                                        loaded active exited    LSB: automatic crash report generation                                                                    
automagic-fan.service                                                                                                                 loaded active running   Automagic fan control                                                                                     
avahi-daemon.service                                                                                                                  loaded active running   Avahi mDNS/DNS-SD Stack                                                                                   
console-setup.service                                                                                                                 loaded active exited    Set console font and keymap                                                                               
containerd.service                                                                                                                    loaded active running   containerd container runtime                                                                              
cron.service                                                                                                                          loaded active running   Regular background program processing daemon                                                              
dbus.service                                                                                                                          loaded active running   D-Bus System Message Bus                                                                                  
docker.service                                                                                                                        loaded active running   Docker Application Container Engine                                                                       
getty@tty1.service                                                                                                                    loaded active running   Getty on tty1                                                                                             
grub-common.service                                                                                                                   loaded active exited    LSB: Record successful boot for GRUB                                                                      
haveged.service                                                                                                                       loaded active running   Entropy daemon using the HAVEGE algorithm                                                                 
jetson_performance.service                                                                                                            loaded active exited    Jetson performance is a script to control jetson_clock                                                    
jetson_stats_boot.service                                                                                                             loaded active exited    Setup fan at startup                                                                                      
k3s-agent.service                                                                                                                     loaded active running   Lightweight Kubernetes                                                                                    
kerneloops.service                                                                                                                    loaded active running   Tool to automatically collect and submit kernel crash signatures                                          
keyboard-setup.service                                                                                                                loaded active exited    Set the console keyboard layout                                                                           
kmod-static-nodes.service                                                                                                             loaded active exited    Create list of required static device nodes for the current kernel                                        
ModemManager.service                                                                                                                  loaded active running   Modem Manager                                                                                             
networkd-dispatcher.service                                                                                                           loaded active running   Dispatcher daemon for systemd-networkd                                                                    
networking.service                                                                                                                    loaded active exited    Raise network interfaces                                                                                  
NetworkManager.service                                                                                                                loaded active running   Network Manager                                                                                           
nv-l4t-usb-device-mode.service                                                                                                        loaded active exited    Configure USB flashing port for device mode                                                               
nvargus-daemon.service                                                                                                                loaded active running   Argus daemon                                                                                              
nvgetty.service                                                                                                                       loaded active running   UART on ttyTHS0                                                                                           
nvmemwarning.service                                                                                                                  loaded active running   Display Low memory warning                                                                                
nvphs.service                                                                                                                         loaded active running   PHS daemon                                                                                                
nvs-service.service                                                                                                                   loaded active running   NVS-SERVICE Embedded Sensor HAL Daemon                                                                    
packagekit.service                                                                                                                    loaded active running   PackageKit Daemon                                                                                         
polkit.service                                                                                                                        loaded active running   Authorization Manager                                                                                     
resolvconf.service                                                                                                                    loaded active exited    Nameserver information manager                                                                            
rpcbind.service                                                                                                                       loaded active running   RPC bind portmap service                                                                                  
rsyslog.service                                                                                                                       loaded active running   System Logging Service                                                                                    
serial-getty@ttyGS0.service                                                                                                           loaded active running   Serial Getty on ttyGS0                                                                                    
serial-getty@ttyS0.service                                                                                                            loaded active running   Serial Getty on ttyS0                                                                                     
setvtrgb.service                                                                                                                      loaded active exited    Set console scheme                                                                                        
snapd.seeded.service                                                                                                                  loaded active exited    Wait until snapd is fully seeded                                                                          
speech-dispatcher.service                                                                                                             loaded active exited    LSB: Speech Dispatcher                                                                                    
ssh.service                                                                                                                           loaded active running   OpenBSD Secure Shell server                                                                               
systemd-fsck@dev-sda1.service                                                                                                         loaded active exited    File System Check on /dev/sda1                                                                            
systemd-journal-flush.service                                                                                                         loaded active exited    Flush Journal to Persistent Storage                                                                       
systemd-journald.service                                                                                                              loaded active running   Journal Service                                                                                           
systemd-logind.service                                                                                                                loaded active running   Login Service                                                                                             
systemd-modules-load.service                                                                                                          loaded active exited    Load Kernel Modules                                                                                       
systemd-random-seed.service                                                                                                           loaded active exited    Load/Save Random Seed                                                                                     
systemd-remount-fs.service                                                                                                            loaded active exited    Remount Root and Kernel File Systems                                                                      
systemd-resolved.service                                                                                                              loaded active running   Network Name Resolution                                                                                   
systemd-sysctl.service                                                                                                                loaded active exited    Apply Kernel Variables                                                                                    
systemd-timesyncd.service                                                                                                             loaded active running   Network Time Synchronization                                                                              
systemd-tmpfiles-setup-dev.service                                                                                                    loaded active exited    Create Static Device Nodes in /dev                                                                        
systemd-tmpfiles-setup.service                                                                                                        loaded active exited    Create Volatile Files and Directories                                                                     
systemd-udev-trigger.service                                                                                                          loaded active exited    udev Coldplug all Devices                                                                                 
systemd-udevd.service                                                                                                                 loaded active running   udev Kernel Device Manager                                                                                
systemd-update-utmp.service                                                                                                           loaded active exited    Update UTMP about System Boot/Shutdown                                                                    
systemd-user-sessions.service                                                                                                         loaded active exited    Permit User Sessions                                                                                      
ubuntu-fan.service                                                                                                                    loaded active exited    Ubuntu FAN network setup                                                                                  
user@1000.service                                                                                                                     loaded active running   User Manager for UID 1000                                                                                 
whoopsie.service                                                                                                                      loaded active running   crash report submission daemon                                                                            
wpa_supplicant.service                                                                                                                loaded active running   WPA supplicant
1 Like
 $ grep -r zram /etc/systemd/system

So systemctl disable nvzramconfig

Sorry if my reply wasn’t adequate. I’m better with machines than with people and it wasn’t my intent to make you feel uneasy. :(

So, just to provide some options, these also work to find a unit if anybody finds this useful:

 $ systemctl list-unit-files | grep zram
nvzramconfig.service                       enabled
 $ systemctl list-unit-files *zram*
UNIT FILE            STATE
nvzramconfig.service enabled

1 unit files listed.

Thank you! Clear and very concise. Much appreciated!


Is there any way to give back the swap space to the main / partition?

For example, under root / if I have 2 GB available. I’d like to permanently relinquish my 4GB of swap to the root partition so it now has 6GB (2GB from before + 4GB from what used to be swap).

I tried both resizing the swap and disabling systemctl nvzramconfig. These did resize/disable swap but it’s like the space disappeared instead of being given back to root /.

Is there any way to give back the swap space to the main / partition?

Hi rakshak.talwar,

Please help to open a new topic for your issue. Thanks