Flash wear on USB flash drive

Does openwrt regularly write to flash once it's booted? I plan on installing openwrt x86_64 on a very old usb flash drive which doesn't have wear leveling and am worried about the drive dying from constant writes. How do tasks such as logging and ext4 journaling affect all of this? Also, does the squashfs vs ext4 image make a difference?

OpenWrt does regularly write to flash once it's booted. Tasks such as logging and ext4 journaling involve constant writes to the flash storage, and this can lead to early failure of flash storage that does not have wear leveling.

Squashfs vs. ext4 image does make a difference in terms of the number of writes to the flash storage. Squashfs is a read-only file system, so it does not involve any writes to the flash storage after the initial installation. On the other hand, ext4 is a read-write file system, and it involves frequent writes to the flash storage. Therefore, if you're concerned about the longevity of your flash storage, using a Squashfs image might be a better option

This is not true in most installs, specifically in the default configuration. Under most circumstances, OpenWrt will only write configuration changes to storage... these are typically rather rare.

OpenWrt does not regularly write anything to flash unless the user has changed the default behaviors such as writing logs to storage (default = RAM) and/or zram/swap (default = none), and/or if the user is using the storage for other user purposes (such as in the context of a NAS or other data write intensive tasks).

That said, modern USB flash drives are fairly good in terms of write cycles and are easily and cheaply replaced. So even in a write-intensive situation, an external USB flash drive shouldn't be a big deal to replace from those perspectives. But obviously, reliability of the media is important for many, so in this context, avoid excessive writes if this is a consideration for you.


…and maybe don't choose the oldest/ crappiest USB stick from your collection to run a mission critical device (your router) 24/7. Yes, psherman is right, OpenWrt doesn't write to flash by default (unless you're doing configuration changes or install optional features like an sqld or similar) and can get very far with slow and tiny USB sticks, but that doesn't necessarily mean you have to push your luck (too far).

squashfs images are better at this than ext4, as ext4's journalling does (journal-) writes while reading, but this is still very little writing and shouldn't be a detriment.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.