Best practice moving from sd-card to ssd raspberry

Honestly the best way (not the fastest) is to do a fresh install and copy the files that you need back 1 by 1 and add all the components, sensors etc back from scratch. Because HA gets updated very very frequently there is a lot of unused files that remain etc (or corrupt files etc). I have had many problems fixed just because of a fresh install.

I know it is not the fastest, but you asked for the best way. I sincerely believe that this is the best way. As is with computers and phones. Installing Windows from scratch is always better than to restore a backup.

But then again it is totally up to you. If I were you I’d take a friday or saturday and work through this. I have a pretty large setup and it takes me about 2 evenings to get a fresh install going. This will take considerably less time on smaller setups.

2 Likes

I have Hassbian installation on pi3b+.
First, created a backup on a larger flash drive. Then used Etcher on PC to flash it to the SSD.
To create a backup I followed these: https://pimylifeup.com/backup-raspberry-pi/
https://superuser.com/questions/1097210/clone-only-space-in-use-from-hard-disk
My steps:

  1. Flash Hassbian on a new ssd using Etcher and boot rPI from it.
  2. Mount your SSD and old SD card on rPI. Use an External Hard Drive Enclosure and a USB card reader, these commands are useful:
dmesg      - system log about drives, you need to find your flash drive.
lsusb
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
sudo blkid

E.g. sda1 is your SSD.

sudo mkdir /mnt/bak
sudo mount /dev/sda1 /mnt/bak
ls /mnt/PIHDD
  1. Create the backup. Be careful with disks’ and partitions’ names! Yours may be different, and I may have a mistake here.
    E.g. mmcblk0 is your old SD card
sudo mkdir /mnt/bak/ha_backup
cd /mnt/bak/ha_backup
sudo dd if=/dev/mmcblk0 of=backup.img bs=64K conv=noerror,sync status=progress
  1. If you plan to flash on the PC then dismount the backup disk now. If on rPI - then after the flashing.
lsof /mnt/bak           - check that it is not used.
sudo rmdir /mnt/bak
  1. Flash the image from the flash drive to SSD using Etcher on a PC. You can also restore the backup right on the rPI (do step 4 later then):
sudo dd if=/mnt/bak/ha_backup/backup.img of=/dev/mmcblk1 bs=64K
  1. Plug SSD to rPI and check its health. You may need to reset the readonly bit if SD card was not functional. Options depend on the file system.
sudo fsck -v -p /dev/sda1
  1. Turn off rPI. Remove new SD card and unplug USB card reader from rPI. Only plug the SSD and boot from it.
2 Likes

mgluk, you did this with a USB ssd, or an ssd with an x850 expansion board?

I am looking to do the same just need to know what parts I need to experiment with.

bump…

I have done some more research and it seems on my pi3b+ this should work as expected. My understanding is that setting the boot bit is only necessary on the non-"+" models. Flashing a bootable image with etcher should just work like an sd… i hope.

I’m about to pull the trigger on a startech usb3-sata3 adapter and a kingston 120gb ssd for this. Any advice/pointers are welcome.

I updated my previous post. I used SanDisk SSD Plus 120GB SSD.

With hassos, hasbian, or other? From what I’ve been reading, it seems this may not actually work for me as I’m running hassos. I’ve seen there is a usb boot compatible image of hassos here, and that may be the closest method to what I was after thus far:

I’m still unclear on the differences between running raspbian+hassio as outlined in this thread:

…versus just using that usb bootable image instead. Either way, I have to learn how to transfer my configuration to the new system.

I do not think it matters whether you have HASSIO or Hassbian. You just need to boot from something to run my steps. You also can use a different method to create a backup, e.g. on a PC. But anyway you need to fix a file system corruption on the restored image.

mgluk, I may well not understand it correctly. I have read a lot of info about how hassos cannot be made usb bootable… devs only intend to allow moving the database to ssd… etc. All the tut’s on installing hassio on ssd seem to make use of either resin-os or hassbian, then you install docker, then install hassio in docker (or something like that?). Some folks use scripts to do it, some do it manually.

I’m not sure on how that goes as I’ve never done it that way; my previous instance was just a hassio (hassos based) image for rpi flashed on an sdcard… plug it in, turn it on, and lovelace pops up to guide you through… no terminal commands to install docker, hassio, etc. OS updates are done through the gui (vs having to ssh in to use apt-get… or making a cron job, etc). This is the ‘noob’ level system I’m talking about.

Well, it works! I’ve got hassos running on my pi3b+ with no sd card:

Hi, I managed to get mine restored to an SSD and it seems to work fine, the only problem is that i can no longer update my hassio. I checked the File System and my dev/root is full. My SSD is 120gb so i am guessing the file system never expanded to use all the space. Is there anyway to expand it? Thanks.

I’m not sure there is a way after it is installed to reallocate missing drive space. How did you go about ‘restoring’? The recommended method to upgrade to ssd is with a ‘fresh install’ of hassos 3.5rc… then you restore your data from a snapshot file (which should be taken before the upgrade).

Since some folks have had issues with snapshot restores, I would also recommend first attempting to restore a full snapshot on your existing system to make sure it works before attempting to upgrade to an ssd.

This is what i did:

  1. Full snapshot of system running on SD card
  2. Install HASSIO 3.5 to ssd using Etcher (i enabled the unsafe mode just incase)
  3. Hassio booted up, created a user and made a snapshot (just so i could find the snapshot folder).
  4. I uploaded my SD Card snapshot and did a full restore.
  5. Hassio booted up fine.

As i mentioned earlier i wasnt able to update afterwards even though everything seemed to be working. It was nothing to do with the hd space as i orginally thought, it turned out to be the http entry in my config file (legacy api password i think). I removed the hole thing and it finally updated (i guess it had been depreciated).

So far i have been running it on the SSD for 2 weeks and everything works much better, logs open quicker, reboots are fast etc and i feel safer that its not suddenl going to die on me.

1 Like

Any problems after HassOS reboot or power cut?

No issues after reboot or power loss so far.

1 Like

Your SSD type? And USB adapter?

Adapter

SSD

Is it a 32GB or 64GB? I bought a 64GB msata wuth a X850 board and when I use etcher to load Hassio onto it I get an error that my drive is too large. I also noticed that when it writes to the SSD it uploads between 9mb/s and 1mb/s (goes up and down never stable) and then stops for like a few seconds then uploads again…is it normal that it stops and goes like this (etcher)? It takes forever to load the Hassio image…

Also do I need to connect the 5V on the X850? I noticed it gets power from the USB so is it needed?

I get this error after etcher finishes loading the image:
2020-01-18_19-15-32

So etcher keeps destroying my ssd, I have to always use disk management to revive it…

Maybe this topic can help: https://forums.balena.io/t/checksums-do-not-match/36537

So I’m stuck at burning Hassio into an mSATA ssd. No matter what I try it doesn’t partition properly or corrupts the drive.

This is the closest I got but as you can see the partitions are unknown for some reason. Is there a way to fix this?

So anyone using the X850 with a KingSpec mSATA SSD 64GB?

I can burn the latest Hassio image unto the mSATA but I get a “checksums do not match” at the end. Tried the various fixes for Win10 but nothing fixes it.

But the SSD seem to have the correct info on it so I connected it to my Pi3B+ I can see the Pi loading led blinking and I can see the ssd lights blinking but then the Pi loading led goes off and the SSD lights all stay on while the ethernet light keeps blinking. The hassio is not detected by my router. So not sure what is happening…

When I boot from SD while the SSD is connected I get this in the hardware so I believe the SSD is detected…

I moved hass.os from sd to ssd on RPi 3B+ (with X820 adapter) since a week in a very easy way:

  • made a snapshot of whole system and downloaded the tar image into pc.
  • flashed with Balena the latest release of hass.os into the ssd (ssd connected with a usb to sata adapter, no repartitioning or other stuff… just flashed!).
  • turned off home assistant and installed the ssd into X820 then connected it to pi.
  • removed the sd card and turned on the pi.
  • after some minutes connected to local ip of the new installation and resumed the home assistant backup saved to my pc (MAKE SURE TO UNCHECK HOME ASSISTANT TICK FROM THE LIST, RESUME ONLY “FOLDERS” AND “ADD-ON”)
  • take a coffee and wait 10-15 mins then go to the “old” web page of home assistant installation (the one with ssl in my case).

Now my system is up and running, without sd card, really faster than before.
Just to specify, I use a Liteon sata SSD 128Gb and a 5V 4A power adapter connected to the x820 board that route power into RPi with a usb cable (that was provided with the adapter board)

1 Like