Recorder - sqlite db on external harddrive

I have tried every possible combination to get Home Assistant to use a sqlite database stored on an external usb harddrive, but it always gives me:

Invalid config for [recorder]: expected a URL for dictionary value @ data['recorder']['db_url']. Got 'sqlite:////media/rpi2-usb/home-assistant_v2.db'

I have tried the following values:

db_url: sqlite://media/rpi2-usb/home-assistant_v2.db
db_url: sqlite:///media/rpi2-usb/home-assistant_v2.db
db_url: sqlite:////media/rpi2-usb/home-assistant_v2.db

The Hass error log also gave me the following templates:

Sep 11 23:15:16 Home-Assistant hass[20563]: sqlite:///:memory: (or, sqlite://)
Sep 11 23:15:16 Home-Assistant hass[20563]: sqlite:///relative/path/to/file.db
Sep 11 23:15:16 Home-Assistant hass[20563]: sqlite:////absolute/path/to/file.db

And since this is an absolute path from the root of my Raspbery Pi, it would suggest I have to use the 4 forward-slashes:

db_url: sqlite:////media/rpi2-usb/home-assistant_v2.db

Yet no matter what I do, it gives me the invalid config for [recorder]

Does it have a problem with the “-” in the folder name or file name or both you think?

How about making a symlink in your config directory?

ln -s /media/rpi2-usb/home-assistant_v2.db home-assistant_v2.db 

There seems to be a bug in the config validation, so it will only except urls and not filepaths.

You should report it here:

1 Like

Thanks @Landrash, I don’t know why I didn’t think about doing that in the first place

@Danielhiversen, thanks, went ahead and filed a bug