[PATCH] base-files: add option to make /var persistent

Stijn Tintel stijn at linux-ipv6.be
Fri Aug 6 17:46:29 PDT 2021


On 7/08/2021 02:56, Alberto Bursi wrote:
>
>
> On 06/08/21 21:27, Stijn Tintel wrote:
>> In OpenWrt, /var is symlinked to /tmp by default. This is done to reduce
>> the amount of writes to the flash chip, which often don't have the
>> greatest durability. As a result, things like DHCP or UPnP lease files,
>> are not persistent across reboots.
>>
>> Since OpenWrt can run on devices with more durable storage, it makes
>> sense to have an option for a persistent /var. Add an option to make
>> /var persistent. When enabled, /var will no longer be symlinked to /tmp,
>> but /var/run will be symlink to /tmp/run, as it should contain only
>> files that should not be kept during reboot. The option is off by
>> default, to maintain the current behaviour.
>>
>
> Since it does not really need to recompile anything, I think it
> can/should be handled as a package, not as a compile option.
>
> When you install the package these operations are executed, if you
> remove the package they are undone. 

Removing /var at runtime, which basically happens when you remove the
symlink, is very ugly and has a huge potential for breakage. Having it
as a build option also avoids users from accidentally installing it as a
package. If you disagree, please elaborate further, including measures
to avoid random breakage caused by removing /var at runtime.

Thanks,
Stijn




More information about the openwrt-devel mailing list