Recently I acquired a Raspberry Pi 4 with 8GB of RAM, bigger from the RPi 4 with 4GB where I have my Nextcloud. The reason is that I intend to install the LibreOffice apps (that I've read that consumes RAM) and I'd like to have also an Akkoma instance running in the same machine. I was wondering if it'd be as simple as swapping the SD Cards, so just tried it 🚀

tl;dr -> Yes

Yes, it's as simple as swapping the SD Cards between Raspberries.

First I did a quick search in internet to end up in an old-ish entry in the Raspberry Pi official forum where they explain that all new Raspbian images are compatible with the previous ones. In my case is even easier, as I move from a Raspberry Pi 4 to another Raspberry Pi 4.

Then, due to my extensive knowledge on Nextcloud and Docker, I searched for the steps to bring down both: for Nextcloud there is no such a stop button, but it's recommended to enter into maintenance mode so that client apps get notified and the system gets clean, and for the Docker, well, I got to know the stop command.

Then I simply executed the swap and started the new Raspberry over, removed the maintenance mode and volià.

Ok, give me the steps anyways

Yeah, I knew it. There we go. I'm starting from the installation setup done in the previous Nextcloud article.

  1. SSh into the Raspberry

    ssh xavier@tatooine
  2. Enter into Maintenance mode

    occ maintenance:mode --on

    Maintenante mode

  3. Wait some minutes, to let some time to the clients to receive the maintenance signal

  4. Stop reverse-proxy container

    cd ~/reverse-proxy/
    docker stop stop 
  5. Stop Nextcloud containers (App and database)

    cd ~/nextcloud/
    docker compose stop
  6. Stop the Raspberry Pi itself

    sudo shutdown -h now
  7. Disconnect the power cable from the origin Raspberry Pi

  8. Remove the SD Card from the origin Raspberry Pi and insert it into the target Raspberry Pi

  9. Disconnect the USBs from the origin Raspberry Pi and connect them into the target Raspberry Pi

  10. Make sure that the target Raspberry Pi has the ethernet cable connected (and the cable connected to the network!)

  11. Connect the power cable in the target Raspberry Pi. If we have the HDMI cable connected we’ll see the Raspberry Pi starting and we’ll see that the docker containers are actually starting too!

  12. When the Raspberry finishes starting, ssh into it and check that the containers are running

    docker ps

    docker ps

  13. Exit from the maintenance mode

    occ maintenance:mode --off
  14. Navigate to the domain that points to the Nextcloud instance and see the beautiful Dashboard waving us!

Extra ball, this is the htop output! htop output

Wrapping up

So for one time, the whole process was way easier than expected. To be honest, I expected quite some complications, like issues recognizing the hardware, or problems regarding hardware IDs hardcoded in the system, or the Docker installation refusing to start after the swap, but no, everything was smooth and easy.

Previous Post Next Post