I used to use vnstat (v1), where every interface has its very own database file as well as a backup file. There are several of those files, like "br-guest" for my lan interface and ".br-guest" which should be the corresponding backup file.
I pretty much threw away my previous OpenWRT 18.06 installation and set up a new 22.03 one.
My previous network setup used a couple of bridges. Basically, every interface was its own bridge. So there are currently 6 different vnstat database files, all starting with "br-".
My new setup only has a single "br-lan" bridge but several interface all targeting e.g. "br-lan.10" for my guest network.
So in addition to just importing existing vnstat data, I guess I need to rename interface mappings here.
Given I'm trying to install vnstat v2 now, how would I import historic data into the new database format?
Just in case v1 and v2 are not compatible at all: Since my interfaces are now named completely different, my existing db files are not detected properly. Simply renaming them does not work.
Migrating from v1 to v2 is not possible at the moment. I guess since v2 is SQLite and v1 can be exported to txt creating a little migration script isn't entirely impossible, but I guess for now I'll stick to v1
The trick is exporting v1 to txt on the old device and importing it from text on the new device.
Just in case someone needs to see this:
# On the old machine because we need the old network names here
vnstat --exportdb -i br-guest > guest.txt
# On the new machine because we target new network names
vnstat --importdb guest.txt -i br-lan.10
Maybe vi into the guest.db and adjust the "interface" and "nick" line, those seem to be stored as labels. Otherwise, the old interface names are shown even though they are gone, which doesn't exactly foster clarity.