TX2 Internal memory auto TRIM

Does the the internal memory of the TX2 (running L4T28.1) automatically trim? I took an image of my TX2 via

sudo ./flash.sh -r -k APP -G system.img jetson-tx2 mmcblk0p1

and to my surprise the resulting image was about 26GB even though only about 13 GB on the device was used. I issued the trim command:

sudo fstrim --all

which took about 10 seconds or so to complete. I took the image of the TX2 again and this time it was the expected 13 GB.

This got me thinking that I may be unexpectedly having slower than optimal disk write speeds during performance critical tests. It appears you can see if your ssd supports automatically TRIM by

hdparm -I /dev/mmcblk0

however on the TX2 I get the result:

/dev/mmcblk0:
HDIO_DRIVE_CMD(identify) failed: Invalid argument

I’ve set up a cron job to run it once a day (at midnight) but am curious if there is a better way.

I don’t know how fstrim works, but the flash.sh clone takes what is essentially a dd copy of the partition. It also produces a “sparse” version (the full size is the raw image, the sparse version is less than raw size, but approaches raw size as content fills up). The size of the partition cloned is a GPT size and will have no knowledge of what is contained in that partition…it is a bit-for-bit exact copy. I doubt any change in content would have even a 1 byte change in total clone size when looking at the raw image (sparse image is a different story, but sparse is always converted to raw as it populates the disk).

Hi StrikeEagleIII,

to my surprise the resulting image was about 26GB even though only about 13 GB on the device was used.
Did you mean sparse image size? If yes, it may be expected.

HDIO_DRIVE_CMD(identify) failed: Invalid argument
not sure if it’s due to lack of hdparm support.