Persistent /var for VM, x86, and ARM users w/ SSDs or virtual disks

Philip Prindeville philipp_subx at redfish-solutions.com
Sun May 25 13:42:04 PDT 2025


Hi,

I’ve been using an PC engines APU v6 with an SSD for persistent storage for a while, and my /var is memory based.

I’d love to have it (or at least /var/log/) be persistent across reboots.

I have a lot of free, unused space on the device:

root at OpenWrt:~# fdisk /dev/sda

The number of cylinders for this disk is set to 3892.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p
Disk /dev/sda: 30 GB, 32017047552 bytes, 62533296 sectors
3892 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/sda1 *  0,8,9       41,2,18            512      41471      40960 20.0M 83 Linux
/dev/sda2    41,10,27    31,7,55          41984    2096127    2054144 1003M 83 Linux

Command (m for help): q

root at OpenWrt:~# 


Can someone add an option to format the extra space as an ext4 space (some or all of it) on reboot and convert it into a persistent /var?

Either as a sysupgrade option or a startup script that runs early in execution.

I think Daniel wrote something similar but it wasn’t applicable to my situation for some reason.  I forget the details.  Felix added a partition for NAND to store sensitive data across reboots.  I think this should be relatively simple, I just don’t want to corrupt my filesystems getting it right.

Thanks,

-Philip




More information about the openwrt-devel mailing list