since OpenWRT's squashfs mode is tailored towards running from slow and short-living mtd flash, I was wondering if using the ext4 installation on x86 make any real difference regarding flash wear out. Or to put it in other words: Is there any advantage in running OpenWRT (as router/firewall) from an msata ssd over using a sdcard?
The standard image for the standard user doesnt really write anything beside config changes. Certain plugins will affect that, for example saving logs or using a local adblock.
You can disable journaling on ext4.
In general f2fs help a lot in matter of wear and write performance if the flash storage doesnt have respectively a controller and/or own cache like your sdcard.
So go for f2fs with the image builder, only because of performance advantages.
At the end, it shouldn't matter until you write a lot of data on that sdcard.
The squashfs version of 19.07.2 by default uses a f2fs overlay. This overlay is formed at boot time by an unusual process that splits the /dev/sda2 partition into the original squashfs (alias /dev/root) and a f2fs which starts at the end of the squashfs (alias /dev/loop0).
This makes it not trivial (though certainly possible) to expand the f2fs and have a larger overlay.
If you are storing a lot of data it would make sense to create and mount an additional data partition, then that data can be kept separate while upgrading the OS.
Thank you for these suggestions! And yes I know about f2fs and the ImageBuilder, but I was looking for something that is also easily upgradable afterwards without the need to rebuild anything.
I did some experiments with the combined-squashfs image before going for the ext4-rootfs but it seemed like it didn't have almost any space for installing even basic stuff (such as drivers for my wifi and usb-lan adapters).
So it looks to me like running the squashfs image works just fine. And this is basically much better than ext4 from the wear-leveling perspective. I think I am going for this solution then.
Note (when retrying this months later): If you use KVM and raw DD images, KVM remembers the size. So if you do it wrong the first time, you have to remove and add the dd image again, so that KVM realizes the right disk size and communicates this to the running OpenWRT.
I've used an SD card for my x86 box for 2 years, no issue. It was a 64 GB Sandisk card, and I opted not to do a resize of the image after the fact. I know that for SSDs, the flash would automatically ignore any bad blocks and write to good ones, so I never bothered to resize as the drive would've already done this. Additionally, never needed the space. I used the EXT4 combined image.
Personally, I consider wasting resources (SD cards) and lifetime to work around issues that don't occur when using a suitable filesystem not a favorable approach.
it all depends on what packages you install. By default the OpenWrt system does not write anything to storage so SD card or USB flash drive is fine.
If you install packages that need to write things constantly in the storage (update a list/database of information, save logs to disk, download files from the internet) then a SD card will wear out.
Wear leveling works on SD cards, on USB drives and on SSDs, f2fs filesystem or ext4 filesystem don't change write endurance.
Even if you use f2fs the SD card will wear out and fail after you have written around the same amount of data to it.
The main difference is performance, f2fs should be faster.
But this matters only if you write things to the storage and on reboot of the device.