Move DB files and Logs to Thumb Drive on Pi

Some great stuff by @briancribbs and @Tinkerer that I took as my own. :slight_smile:
Extend the life of your SD Card…

3 Likes

I personally have moved /tmp to RAM and symlinked the hass log file to /tmp/home-assistant.log. I do lose the log file on reboots and power cuts, but this way there’s absolutely no wear on my SD card. I also use an external SQL database on a different host with proper hard drive.

2 Likes

I tried putting my database on the thumb drive this morning, but looking at the amount of io it saved, I’m not sure it is worth the effort.

$ iostat
Linux 4.9.41+ (raspberrypi)     24/10/17        _armv6l_        (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          14.27    0.00    2.55    1.48    0.00   81.70

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
mmcblk0           3.81        33.90        37.77   35386809   39434048
sda               0.07         0.01         0.32       9681     338957

Is this unusual?

Mine is a little different. I have a LOT of devices though in HA.

pi@Carlo-Pi:~ $ iostat
Linux 4.9.35-v7+ (Carlo-Pi)     10/24/2017      _armv7l_        (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           8.06    0.00    6.84    2.04    0.00   83.05

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
mmcblk0           0.99         3.88         9.63     293242     728092
sda               7.53         0.05        85.47       3770    6463028

I’ve also pushed my TTS cache to the flash drive as well.

Would you mind doing a tutorial on this? Sound sensible! Thanks

There’s plenty of tutorials online which I used. Here’s one:

P.S.: keep in mind that when updating HASS you’ll need larger /tmp - I use 150MB. For day to day operation a 50MB /tmp is sufficient.