When adding 500GB NVMe SSD, create SWAP?

Hi… just got my new XavierNX… adding 500GB NVMe SSD M.2 card… I’ve read online the instructions for adding it… some say to create a swap file on the NVMe. With 8GB memory in the XNX, the swap should be 2x the MAX RAM size… so 16GB swap area.
Should I do this?

I don’t have an NVMe to test with, so I don’t know what issues you might run into just getting the NVMe to work. If you use the NVMe after boot, and not as a root device, or if you already have the NVMe working as a root device, then probably adding swap is not an issue and would work well. However, there is a warning…

Solid state memory uses wear leveling to increase lifespan. Constant writing to solid state memory can wear the device out. The more free space you have, the better wear leveling works to avoid wearing things out. Heavy swapping will cause failure sooner. Swapping on a system with 100GB of free space will wear out faster than swapping on a system with 400GB of free space. Newer devices, e.g., the pictured 970 Evo Plus last longer than older tech, but wear leveling is still required.

I’ve not set up NVMe on a Jetson, but I’ve seen some people have had difficulty with this. Certainly using this as a root filesystem is more difficult than using this for extra storage since extra storage does not need drivers in U-Boot or CBoot. Booting normally and then using the NVMe for other storage should be reasonably simple.

Adding swap as a file on a Jetson will be no different than doing so on any other Ubuntu 18.04 system. Here are two articles I found on that topic:

1 Like


Yes, it’s fine and it won’t wear down your SSD as long as you’re not writing to it constantly. 2x ram is an older rule of thumb but it won’t hurt. You can probably get away with 1x or even .5x ram on the NX since it already has 8GB of ram.

re: wear leveling. Swap won’t hurt much if it’s not often used. You can modify the swappiness value to set it to only be used when necessary (see article below). I use 10 as a value usually, so it’ll only be used when ram is 90% full. Trim is automatic on Ubuntu on and l4t) (see systemctl status fstrim) so the discard mount option should probably not be used (it hurts performance). Likewise, overprovisioning (reserving free space) is no longer necessary. The noatime mount option for any data parttions on eMMC, SD, or NVMe is a very good idea. Using tmpfs strategically for frequently written areas of your filesystem can also help to avoid disk writes.

Some more up-to-date tips for ssds here:

And classic, mostly up-to-date tips here:


1 Like

THANK YOU both for your reply and excellent suggestions!