Install Home Assistant on SSD with Raspberry Pi

Tutorial for migrating from a micro SD card to an SSD on Raspberry 3 or 4

Many of us are now interested in automation DIY, the classic beginner's course often consisting in first obtaining a Raspberry Pi with a microSD card, generally included in a pack, then to proceed with theinstalling Home Assistant OS on the latter. This is perfect for getting started and discovering the home automation solution, but after several months or years, you may be faced with backups that get stuck in a too heavy database (2 GB max on micro-SD), to restorations of failed snapshots, etc… In addition, the lifespan of a micro SD card is in no way comparable to that of an SSD disk, this is why we have chosen to explain to you today how to migrate Home Assistant to SSD with Raspberry Pi.

Take your time, make yourself comfortable, read carefully and follow the steps one by one… And you can very quickly take full advantage of your Home Assistant instance on SSD! Come on, follow the guide!

Migrating Home Assistant from microSD to SSD

Prerequisites

First of all, we will need a little equipment, in particular an SSD and a USB cable, or even quite simply a 3.5 ″ drive enclosure which is even simpler. But, first of all, we invite you to make a Home Assistant OS backup (get the snapshot file). This is important, not to say essential, so that you do not lose all the work already done on your home automation server.

The necessary equipment :

  • 1x blank micro SD card
  • 1 x SSD
  • 1 x 3.5 ″ case with USB cable or a SATA to USB adapter
  • Are you using a Raspberry 3? What luck ! You can go directly to paragraph « Download Home Assistant OS » and skip all those long and painful stages.
  • Do you shoot with a Raspberry 4? Sorry, you must carefully follow the directions below. Rest assured, it's just a little while, there is no difficulty.

Manipulations on home automation servers are often scary. Rightly so, because we are quickly lost. But, thanks to French communities such as HACF on Facebook or to Home Assistant tutorials in French, you shouldn't have any difficulty! Rest assured, if you follow what follows to the letter, everything will be fine, and we can guarantee it to you to carry out the captures as we go through our personal migration!

Le Raspberry 4 has some issues to boot from an SSD natively. This is because its EEPROM firmware does not work with all USB to SATA adapters available on the market, but fortunately this situation can be easily restored and everything will then work fine.

The Raspberry Pi 4 problem

Le Raspberry Pi 4 has a EEPROM read only memory (it is a memory that is not erased when the device is no longer powered) which allows it to start. We are going to update it with a recent version (2020-12-11 or higher), which will allow us to start from our brand new support SSD connected to USB.

To update this EEPROM, you need to temporarily install Raspberry OS on a MicroSD card (preferably blank / formatted is better). We advise you to keep the current one that has your system. If you have any concerns, simply put it back in the Raspberry Pi. Better to always take precautions!

Tutorial: Install Home Assistant on an SSD

1. Flash Raspberry OS

We will start with download Raspberry Pi OS Lite image then flash on the Micro SD (preferably virgin!). This procedure should sound quite familiar to you since it uses the same software that we typically use for the installation of Home Assistant.

  1. Download Raspberry Pi OS Lite Image
  2. Format your SD card (a quick format is enough) with SD Card Format for example,
  3. Open Whale Etcher and follow the instructions: select the previously downloaded image and select your formatted SD card,
  4. Start the procedure by clicking on “Flash!”.
The process is usually quick and your card is ready in seconds.

2. SSH access

To securely access your Raspberry Pi, we will be using SSG. It's very simple because you just have toadd blank file at the root of the boot partition. We will name it "ssh" (remove any file extension, for example ".txt")

Example: in a text editor, create an empty form, with nothing in it, and name it "ssh". Then remove the extension like ".txt". Open your file explorer on your PC, find your SD card, and simply place your "ssh" file like this:

  1. Electrically turn off your Raspberry,
  2. Remove the SD card that you had,
  3. Insert the newly flashed one,
  4. Relight and wait a few minutes.
The rest takes place on your PC, or your Mac, using a terminal.

* On Windows, search for CMD (Command Prompt).

* On Mac, search for Terminal.

In order to communicate in SSH with your Raspberry Pi 4, copy and paste this command:

ssh [email protected]
Attention, you need absolutely replace "IP-of-your-Raspberry-Pi" by the IP address of your Raspberry Pi, which must be something like 192.168.1.50.

In this example, we will therefore write:

ssh [email protected]
It is done ? Hit enter.

Now enter the default password which is none other than: r

You don't see it and this is normal, press "Enter" to continue.

You normally have a window like this:

Since the small "ssh" file that you created will be erased on the first start, the following operations will allow you to maintain SSH access.

Still in Terminal, until the end by the way, copy this command:

sudo raspi-config

Navigate with the arrows on your keyboard, and do " Entrance " on "Interface Options" and select "SSH" :

Select "Yes" :

Validate with " OKAY " :

Finish by going to "Finish" at the bottom :

3. Update EEPROM

Here we are, we can move on to updating the Rpi 4's EEPROM ROM as we explained to you at the start of this tutorial. The idea is to tell the system touse the latest STABLE version.

Copy this command to your Terminal:

sudo nano / etc / default / rpi-eeprom-update

Replace "critical" in place of "stable". Do it right after FIRMWARE_RELEASE_STATUTS = like this:

For this modification to be taken into account, click on the Ctrl + X keys then on the Y button.

We will now update the system:

sudo apt update
sudo apt full-upgrade
sudo reboot
Wait a few moments, the system restarts. The EEPROM will be updated automatically during the boot process.

In order to check that everything went correctly, connect again with (replace well with your IP, otherwise it will obviously not work):

ssh [email protected]

Once connected, you just need to copy this command:

sudo rpi-eeprom-update

You should have a window like this, with a date around 03/09/2020:

Everything is fine ? A priori yes, since you are wise and disciplined. Now is the time to tell our system that we want to boot from an SSD ... At the same time, does it have a choice?

Still from the Terminal, copy this:

sudo raspi-config

Dance Advanced Options, select the 5th line:

Then Bootloader Version, that's good (and that's what you have to do):

Now use your little fingers and select the row Latest Use the latest version boot ROM software (this means that you have to use the latest version of the ROM, if you are ever as bad at English as some webmasters!):

CAUTION: Select then validate with the Enter key.

Validate with  (an abbreviated expression from American English for approval):

Go to Boot order and USB BOOT  :

Choose (you therefore accept):

Select  (that means it's the end ...):

End with (we would have suspected it, right?):

Your dear Raspberry Pi 4 is restarting. Wait a bit, it updates! Above all, do not rush him, he is also susceptible ...

4. Download Home Assistant OS

From the Official GitHub, you must now download the latest version of Home Assistant.

Look for a stable version, that goes without saying. To date, it was the "Version 5 build X (stable) ". Download it (even without fiber, it's fast 😀).

CAUTION:
* Choose the version for Raspberry pi 4 (hassos_rpi4-64-5.X.img.gz)
* If your Raspberry pi 4 with 8 GB of RAM, choose the 64 Bits version (the 32 Bits version does not work for this model) (hassos_rpi4-64-5.X.img.gz)

5. Home Assistant OS on SSD

We are going to bring out the same software as at our beginnings, the famous as well as practical Whale Etcher, and once again flash Home Assistant OS image previously uploaded to the SSD for Home Assistant.

This does:

  1. Unplug your Raspberry (inter or not, cut the juice),
  2. Absolutely remove the SD card which was used for the update ^ (well yes, otherwise it will not do it),
  3. Connect your SSD on a USB3 port (blue of course).
  4. Turn on your Raspberry… Obviously, you have to wait a bit, but then you can connect to your interface as usual!
Keep in mind, even if it is cramped like AB's, that you are going on a new setup. Fortunately, you can very easily grab a backup of your system, and inject it just as quickly.

You can now create a new Home Assistant account, or via the menu ask to restore your backup using the file that we advised you to recover… Not crazy the wasp, eh? We were not born in the last rain! 😉

To recover your backup, go to the menu Supervisor> Snapshots, and you will just have to run it. It will take longer or shorter, but it's worth the wait!

6. Warnings

With an SSD on USB3, interference can unfortunately be a problem, even knocking out your ConBee II key or your RaspBee II. Likewise, your Bluetooth may be very bad, or even totally unusable.

You must therefore absolutely install USB extension cables, in order tomove away the SSD and the ZigBee gateway as much as possible from the SSD. We have made the choice to buy a fairly powerful Bluetooth dongle, but we cannot give you a return yet since it has not yet been received.

Know, all the same, that it is possible to switch the SSD to one of the USB2 ports (black), which will solve the interference concerns, but you will not benefit from USB3 which can be problematic and create latencies especially during startup, writing to the database may be compromised, recording of a video or playing the video stream that goes through the swap can also be problematic. While waiting to receive the BT dongle, we are connected to the USB2, and indeed, the startup is quite long, but everything works!

TO READ :
Home Assistant: installation on Raspberry Pi
Passionate about technology, I discovered the world of Smart Home with Xiaomi, then Alexa and Les Alexiens led me to become passionate about Home Assistant, which I master better every day!