Migration from RPI > VM

Hi Everyone

just making sure I’m doing this right

What’s the best process for moving my openhabian setup from a RPI too a Hyper V VM running Ubuntu Server 18.04.2

I have lots of backups of my system using Amanda

I have already setup the VM and Installed Openhabian using the official guide somewhere will link shortly

Next steps?

Install Amanda on the VM mount my NAS where the backups are and run Amfetchdump?

Or should I be doing this differently?

If you are using USB devices on your Pi, they will not be accessible in a Hyper-V VM by design.

Hi @Bruce_Osborne thanks for the reply

I’m not using USB devices on my RPI running OH everything is HUB or WIFI based

Well then rethink if you really want to move. More space and energy consumption, higher cost for spare parts etc
If it’s just because of SD card wearout then better stick with your Pi but activate zram which has become available in openHABian.

What for ?
Sure you can install Amanda and use it to backup all of your servers in the future, but you cannot restore your RPi’s backup to the VM.
To migrate your config, you should use openhab-cli backup/restore.


Hi again @mstormi

I want too move because of ease of backing up the entire VM server also checkpoints making it super easy too test new stuff, also because the VM server is more powerful than a RPI allowing me too use things like more powerful voice tts ect

The VM server already runs 24/7 so adding an additional VM for openhab is no worries

My mistake I thought you could :slight_smile:

Will I need too install stuff like influx dB again or will that be restored also

You can’t do this using Amanda. Amanda backs up everything including all the programs and files on the file system. If you are running on an RPi, then all those programs are compiled and configured to run on an ARM processor. Your VM is going to be running on an Intel processor. You can’t run a program compiled for one processor on the other.

You will have to look at each and every program you’ve installed or openHABian has installed to see how to back up the data for those individual programs. This will be super easy for something like Frontail, there’s nothing to do. Something like InfluxDB or Grafana though is going to take some work to figure out where the data and custom configs are that you need to back up.

openhab-cli backup and restore will only do so for openHAB itself.

Hi again @rlkoshak

Thanks for the advice and clarification there i have moments of stupidity lol :smiley: of course you are right here

I want this done ASAP

In your opinion would It be faster starting fresh and copying config files ect only

Trying to do something like this in a hurry is almost a guarantee for disaster. To be successful you need to be deliberate, slow, and do your research. For example, if you just copy the config files you are going to miss the data files (e.g. InfluxDB or MySQL). If you just blindly copy the whole /etc folder over you will overwrite system configs that are specific to Ubuntu with versions that are specific to Raspbian. Again, it’s a recipe for disaster.

There is no fast way to do this.

I’ve spilt my openHAB and my database servers into separate VMs. The last time I rebuilt my openHAB server I simply installed Ubuntu on a new VM, set up my USBoIP config (doesn’t apply in your case), used the openhab-cli backup and restore commands and Bob’s your uncle.

Im going on holiday soon & I wanted to get it done before we go but I don’t think it’s worth the risk.

so I will leave this until I get home

now my time is better spent finishing automating my lights ect too scare away intruders I have got something up and running but the lights trigger at the same time due too simple rules I need too somehow add something that makes them fire at slightly different times might post about it later because iv not got a clue on this one

I have tried this it worked perfect just couldn’t get influxdb working again

The influx install from openhabian-config results in an error so I followed the original guide seemed like it worked but as soon as I restore data I get an authorisation error

There are several approaches posted to the forum. My preferred is to use Persistence and this simple Rule:

rule "Simulate presence"
    Time "cron 0 * * * ? *" // probably not the right syntax
    if(Simulate_Presence.state == ON) 
        Lights_All.members.forEach[light | light.sendCommand(light.historicState(now.minusDays(7)).state)]

Every minute, change the lights to what ever state they were in at this time seven days ago.

1 Like

Thanks for that Rich

Yes a couple of things needed fixing i have tested the rule works perfectly like a work of art it has right put too shame my old rules :frowning: and reminded me i still need too learn alot more about openhab

Im very impressed with it Thanks Again

Heres the fixed version for anyone else

rule "Simulate presence"
    Time cron "	0 0/1 * 1/1 * ? *" // Every 1 Min
if( SimulatePresence.state == ON ) {
	logInfo("NOTE", "Simulate Presence Ran")
    LightGroup.members.forEach[light | light.sendCommand(light.historicState(now.minusDays(7)).state)]