I am currently running my openhab instance on my Raspberry Pi 3 and would like to switch to the Raspberry Pi 4.
Can I just create an image file of the whole Raspberry Pi and then flash it onto the Raspberry 4 ?
Or is there any kind of different method to do such a switch ?
I would not try that. I know the 4 needs the latest OS and if CPU architecture is different the 4 may not boot from the OS. If you are using any USB devices I recommend connecting them through a non-powered hub. The Pi 4 USB has a standards based bug.
The RPi4 works very different to the RPi3, RPi4 needs a buster Raspbian to start (and it’s not enough to upgrade the RPi3 before moving to RPi4). The easiest way to move over is to make a Backup from openhab (use openhab-cli backup) and after installing the RPi4 restore it.
I had exactly the same question 6 weeks ago. I have moved the system in following steps
- backup my system
- install a fresh system on the Pi4, with same passwords
- copy root to USB / SDD
- restore backup for openhab, influxDB and grafana
I found this instructions in https://seven1m.sdf.org/tutorials/upgrade_raspberry_pi_3_to_4_with_same_sd_card.html.
I hope they can help you:
# Upgrade (Swap) Your Raspberry Pi 3 to a Raspberry Pi 4 Using the Same SD Card
*written October 2019*
I recently upgraded my home Raspberry Pi server hardware from the Raspberry Pi model 3 to model 4. I was not interested in reinstalling Raspbian and all my home server software, so I went searching for a way to swap the SD card over to the new hardware.
Raspberry Pi 4, for a reason I'm not familiar with, requires a larger `boot` partition. You cannot just insert your existing SD card into the new Raspberry Pi 4, because the code necessary to boot it won't be there.
In short, the fix for this is:
1. Upgrade Raspbian
2. Enlarge the boot partition
3. Update the bootloader
4. Swap the card
Read on for the specifics...
1. **Make a backup!** Pop the card in your laptop or desktop computer and image the SD card to a file. [Here is a guide for that.](https://thepihut.com/blogs/raspberry-pi-tutorials/17789160-backing-up-and-restoring-your-raspberry-pis-sd-card)
2. While your SD card is still in your old Raspberry Pi, upgrade your version of Raspbian to Raspbian Buster. Basically, do this:
1. `sudo apt update && sudo apt dist-upgrade`
3. edit the file `/etc/apt/sources.list.d/raspi.list` and change the word "stretch" to "buster". Save the file.
4. `sudo apt update && sudo apt dist-upgrade`
3. If that went well, then you need to shut down your Pi and take out the SD card. Pop it in your laptop or desktop with a special program running: [GParted](https://gparted.org/). If your computer isn't running Linux, you can download a Live CD version of GParted and boot from a CD or USB. There are guides for helping you with that.
4. Point GParted at your SD card and do these two things, then apply changes:
1. Move the second partition to the right by about 200MB.
2. Enlarge the first partition to fill the available space. Be sure not to change the start position of the first partition, or your Pi won't boot. Also make sure your first partition is at least 250 MB.Once the changes are applied, unmount the SD card and put it back in your Raspberry Pi 3.
5. Run the following command: `sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel`
6. Swap the SD card over to the new Raspberry Pi and boot it up!