Upgrading Home Assistant (Hass.io) Storage Without Reinstallation
Running out of disk space is a common issue in home automation setups, especially when using smaller SD cards on Raspberry Pi systems. Recently, I faced this exact challenge with my Home Assistant (Hass.io) setup. I was using an 16GB SD card that became full, and I decided to upgrade to a 32GB SD card trying to retain all current data and settings to avoid a backup restore process or reinstall.
Steps Taken
1. Eject the SD Card from the Raspberry Pi
Power down the Raspberry Pi and safely eject the SD card.
2. Insert the SD Card into Your Computer
Using an SD card reader, insert the SD card into your computer. In my case, I used a Macbook.
3. Identify the SD Card
Run the following command to list all connected disks:
1diskutil list
Locate the correct disk. On my system, the SD card was identified as /dev/disk4
. You should be able to find it by looking at the capacity of the disk.
4. Clone the SD Card to a Disk Image
Use the gdd
command to create a backup of the SD card as a .dmg
file on your computer:
Note to add a r
in front of the disk name.
1sudo gdd if=/dev/rdisk4 of=hassio-backup.dmg status=progress bs=16M
Tip: The bs=16M
flag improves performance by reading and writing in 16MB blocks. Adjusting the block size (bs) can significantly impact cloning speed, especially for larger SD cards. Testing with values like bs=32M
or bs=64M
can sometimes yield faster results, depending on your system’s capabilities. In my case it took about 3 minutes to clone 16GB using 16MB blocks.
5. Insert the New 32GB SD Card
Eject the old SD card and insert the new SD card into your computer.
6. Unmount the New SD Card
Identify the new SD card using diskutil list again and unmount it:
1sudo diskutil unmountDisk /dev/disk4
7. Restore the Disk Image to the New SD Card
Copy the disk image to the new SD card using the following command:
1sudo gdd of=/dev/rdisk4 if=hassio-backup.dmg status=progress bs=16M
8. Insert the New SD Card into the Raspberry Pi
After the process completes, eject the new SD card from your computer and insert it into your Raspberry Pi. Power it back on, and Home Assistant should boot up with all your data intact.
Additional Notes
One of the advantages of Hass.io (tested on Home Assistant 2024.12.5) is that it automatically claims all available space on the new SD card. This eliminates the need to use tools like GParted to resize partitions after restoring the disk image.
Conclusion
Ofc this isn’t the best approach. I think the process would be similar when switching to a SSD drive. But for now this method allowed me to seamlessly upgrade my Home Assistant storage without losing any data or having to reconfigure my system and, leveraging Hass.io’s automatic partition management, I avoided a time-consuming reinstall process.
If you’re facing similar storage constraints, I hope these steps help you upgrade your setup efficiently. Feel free to experiment with different block sizes in the gdd
command for better performance during the cloning process!