Installing Home Assistant on a RPi 4b with SSD boot

It’s on your boot partition of your drive. You can ssh into your Pi and mount /dev/sda1, alternatively stick the drive in a laptop and you’ll see the boot partition. Edit and save the file, then reboot.

…or alternatively boot the Pi once more with the Raspberry OS SD from this guide and leave the SSD attached. Raspberry OS should find and mount the boot partition and you should see it lying on the desktop.

Oh that’s a great method! Cause i only have a mac and having trouble mounting the ssd. Thanks!

I took my RPi4 down today and rebooted it with RPi OS to verify my own statement.
And… sorry, I was oversimplifying the procedure. You have to take some more steps:

RPi OS automatically boots the Linux partitions that it finds on the SSD.
But it does NOT mount the FAT32 boot partition.

You have to mount that partition manually in a terminal window of RPi OS.
Here are the steps:


Start RPi OS from SD with the HA SSD still attached.
Open a terminal window and get a list of all attached disks and all partitions on them:

pi@raspberrypi:~ $ sudo fdisk -l

Result should be a rather long list of RAM disks (/dev/ram00, 01,…) followed by the SD card (/dev/mmcblk0) and finally the SSD (/dev/sda) with all its partitions:

Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Disk model: 00SSD1          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 0CACA848-8337-434D-842B-39970CFD2962

Device       Start       End   Sectors   Size Type
/dev/sda1     2048     67583     65536    32M Microsoft reserved
/dev/sda2    67584    116735     49152    24M Linux filesystem
/dev/sda3   116736    641023    524288   256M Linux filesystem
/dev/sda4   641024    690175     49152    24M Linux filesystem
/dev/sda5   690176   1214463    524288   256M Linux filesystem
/dev/sda6  1214464   1230847     16384     8M Linux filesystem
/dev/sda7  1230848   1427455    196608    96M Linux filesystem
/dev/sda8  1427456 234441614 233014159 111.1G Linux filesystem

The partition /dev/sda1 with type “Microsoft reserved” is the boot partition we are looking for.
Create a mount point and mount it:

pi@raspberrypi:~ $ sudo mkdir /mnt/HassBoot
pi@raspberrypi:~ $ sudo mount -t vfat /dev/sda1 /mnt/HassBoot/

Now you should be able to ls into the boot partition:

pi@raspberrypi:~ $ ls -al /mnt/HassBoot/
total 2806
drwxr-xr-x 3 root root   16384 Jan  1  1970 .
drwxr-xr-x 4 root root    4096 Sep 27 12:17 ..
-rwxr-xr-x 1 root root   41499 Oct 25  2020 bcm2711-rpi-4-b.dtb
-rwxr-xr-x 1 root root    2382 Oct 25  2020 boot.scr
-rwxr-xr-x 1 root root      34 Oct 25  2020 cmdline.txt
-rwxr-xr-x 1 root root    1754 Oct 25  2020 config.txt
-rwxr-xr-x 1 root root    5418 Oct 25  2020 fixup4.dat
drwxr-xr-x 2 root root   18432 Oct 25  2020 overlays
-rwxr-xr-x 1 root root 2278432 Oct 25  2020 start4.elf
-rwxr-xr-x 1 root root  496496 Oct 25  2020 u-boot.bin

You can check and edit config.txt now, i.e. with nano.

If you want to copy something out of here to preserve or use it later:
The easiest way is probably to copy it to the HA data partition that RPi OS has mounted automatically (as it is a Linux partition):

pi@raspberrypi:~ $ sudo cp /mnt/HassBoot/config.txt /media/pi/hassos-data/supervisor/homeassistant/config_from_HA_boot.txt

When you reboot the Pi from SSD you will find that copy in HA’s config folder.

1 Like

Fantastic guide! I was very hesitant to try this when RPI4 got usb boot and HA released the first 5.0 beta. I got it working within minutes now that I can see what does and doesn’t work. I can confirm you can update the EEPROM with Raspberry Pi Manager. This is also what Raspberry advices on their website: https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md

Just burn that on an sd, put it in the Pi and boot. I waited for 5 minutes just to be safe (there is no indication when it’s finished). Then got my usb sata (StarTech) + ssd (
Intenso High Performance 120GB). and just plugged it in with the 5.3 beta on it. Restored to my snapshop after HA booted and all is ready!

This cost me like 35 euro’s in total. Which is very cheap for a reliable and fast solution :smiley:

I hope all stays stable so gonna test this for the coming days/weeks. I have a Conbee II and Z-wave.me sticks plugged in (in the 2.0 port) and the ssd in the 3.0 port. For now everyhing works, so I hope the Zigbee and Zwave networks stay stable.

I keep my sd card in a safe place so I can always revert if needed.

2 Likes

THANK YOU finaly it works…after days of trying now it works…very inportant is having
compatible Adapter…as last try i bought ELUTENG Adapter and finaly finaly it works, im so happy …thank you for your very good installation guide, keep it up :slight_smile:

1 Like

Thanks for the great how-to. Just one thing which is still unclear for me. Are we able to do updates directly in Supervisor or do we need to do that always by flashing the newest version into SSD?

These are done in Supervisor. No need to flash the SSD with every update.

Neither. Supervisor will not show the 5.X dev versions because they are on the dev channel (not the beta channel). But you also don’t need to start at zero again. Read the last topic of the guide: “Update the dev version of Home Assistant OS”

You may want to add the snapshot recovery to your excellent directions. As of .116 “You can now upload snapshots from the UI and restores them. You can do this in the supervisor UI in the snapshots panel. But you can also do this during onboarding!”
I have not tried it yet as I have been waiting for 5.x to get released. My 4 has worked with no issues.

Hi trying this guide…
I have an usb stick https://www.samsung.com/us/computing/memory-storage/usb-flash-drives/usb-3-1-flash-drive-fit-plus-128gb-muf-128ab-am/

Trying to boot from it, i entered 5.3 on it, rebooted but it doesnt do anything, not sure why
its in a blue usb port

any help pls? im at the moment without HA and i need it quickly back

edit: in the beginnin it says recovery.elf not found
then black screen, or should i just wait half an hour ? lol

edit: can i check its looking for the usb for sure?

edit 2: flashed again the usb stick with 64 bit version, now it boots, not sure if it was a bad flash the first run or if its cause its now 64 bit

edit 3: succes ! oh man almost heart attack, will restore snapshot now
edit 4: great, restoring snapshot gives upload error of bad gateway

It’s stated in the guide:

Regarding your shapshot issue. What you also can do is enable samba or ssh and upload the file to the /backup folder and then hit the refresh button. Then you can also select it.

And always always always keep your sd card that you used as it is. Especially if you get in this situation sunday afternoon:

any help pls? im at the moment without HA and i need it quickly back

If anything goes bad with the usb boot, or it’s too buggy you can just insert the sd card and boot. Then you can decide to get a different ssd/usb or wait till version 5 is stable/official.

I had the latest 4.x snapshot which I could never get to restore properly inside 5.4… It was a basic install with just nodered, zigbee2mqtt & Wiz addon with 3 devices.

I have another problem now. The internal time zone seems to be wrong. I did all of them as described in the manual and then reloaded my snapshot. Everything seems to work, but all the timed automations run with +1-hour delay. In the terminal when run “date” I can see that the time is just UTC instead of UTC+1. How I can fix that?

Hi, I have been trying this for a few hours but haven’t succeeded. I have now ordered the ‘compatible’ Eluteng adapter as I have this one https://www.amazon.co.uk/gp/product/B01N2JIQR7/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 it looks damn near identical to the Eluteng one.

I have updated the EEPROM firmware and using the drive and adapter I have I could successfully boot into Raspbian on the SSD (which means it can boot from USB successfully) however when I put the Hassio image on the SSD the Pi seems to go around in endless boot loops from the look of the green LED indicator. I have also ordered a micro HDMI adapter as I have no idea idea what it is doing.

Things I have tried:

  • Flashing with Balena Etcher and Raspberry Pi Imager
  • Flashing with 5.3, 5.2, 5.1 and the latests 4.15 releases
  • Plugging in all the USB ports both USB 2.0 and 3.0

Can anyone confirm that even if I can boot into Raspbian with my SSD and adapter it still may not be compatible with Hassio?

Only version 5.x Hassio images boots from USB.

Try finding out your adapter’s chipset https://jamesachambers.com/raspberry-pi-4-usb-boot-config-guide-for-ssd-flash-drives/

Hi there,

I have successfully used a M.2 SSD with no micro SD card on my Pi4 using the 64 bit V5.3, installed VERY fast.

However, when I went to restore the snapshot that I took earlier from my Pi3 I selected wipe and restore selected (everything ticked), probably not the right thing to do. Looking at the logs it reports a database error.

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:509
Integration: Recorder (documentation, issues)
First occurred: 17:25:57 (27 occurrences)
Last logged: 17:27:58

    Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{}', 'LOCAL', '2020-11-09 17:27:45.058521', '2020-11-09 17:27:45.058521', '726982e4035e721eba54d1b41c2202e3', None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
    Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{}', 'LOCAL', '2020-11-09 17:27:46.077001', '2020-11-09 17:27:46.077001', '5008dee8acf1547249a38e8c92972e06', None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
    Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{}', 'LOCAL', '2020-11-09 17:27:52.225504', '2020-11-09 17:27:52.225504', '145087d626dd3c8e45e14f83a77018b4', None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
    Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{}', 'LOCAL', '2020-11-09 17:27:56.083656', '2020-11-09 17:27:56.083656', '5323f461c81338100c5939c77536a734', None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
    Error saving events: (sqlite3.DatabaseError) database disk image is malformed [SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)] [parameters: ('state_changed', '{}', 'LOCAL', '2020-11-09 17:27:57.073423', '2020-11-09 17:27:57.073423', '4f65c3d0a90199dd372ed249137c3e69', None, None)] (Background on this error at: http://sqlalche.me/e/13/4xp6)

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
sqlite3.DatabaseError: database disk image is malformed

Should I redo the image and only restore certain things?

You should at least just try and delete the database file (/config/home-assistant_v2.db) and restart HA. All you will lose is your entity history of the last 10 days. The db file should be re-built from scratch after restart and should start to fill with new history data immediately.

1 Like

Hi Jpsy,

I’ve deleted the database, rebooted the system and restarted MQTT and it all seems to be working fine. Thanks so much for your original post, it’s much appreciated and very helpful.

I got my build working on the SSD. I just reran the burning of the home assistant image (exactly the same as I had done a couple of times before) and it worked. For reference build 5.4 worked for me.

Quick restore from backup and it worked a treat and I was up in minutes.

I did have to bin out my old database file as for some reason home assistant couldn’t read any historic data.