Use network drive

Hi there.

I have connected a hard drive to my router, and I am trying to make use of it both to store recordings from camera and to store the hass database.

I can set it up both as smb and ftp, but no matter what I do, it does not seem to work. I constantly get a error for the recordings saying “no access to destination”. The user has been granted access to the share, so that should not be the problem.
the approaches I have been trying out are:

smb://username:password@host/path/to/folder/filename_{{ now().strftime(“%Y%m%d-%H%M%S”) }}.mp4
ftp://username:password@host/path/to/folder/filename_{{ now().strftime(“%Y%m%d-%H%M%S”) }}.mp4

For the database, that is a bit different.
I know it is a sqlite database, and the docs says that the path should be sqlite:////path/to/filename.
The example used in the docs only show for a local stored database. unfortunately, I am not able to install something like MariaDB on this drive.
How do I make it connect to a database stored on my network drive?
sqlite:////ftp:// seems way to odd but unfortunately, this is somewhat the thing I can come up with.

What type of installation do you have? What is the external drive connected to? Is it used for other things too?

I doubt you can easily do this with a Hassio HassOS installation. What type of hardware & OS are you running the software on?

Do you want that hard drive to have your active configuration or just snapshots?

Its Hassio og HassOS. The drive is connected to my router, and works as a network drive that I can at least get access to from Windows.
It is completely empty except for to folders for db and recordings.
I run it on a Raspberry Pi with both a conbee and z-stick connected. So I did not have the guts to try connecting it directly to the pi, because I am not sure the power is sufficient.

The main idea was to have the active db stored on the network drive, to avoid having it on the SD card.

If you has Hassio on Raspbian or Ubuntu you woulsd have assess to the Samba client and could use smb to mount the drive.
HassOs only has the Samba server and it is in a Docker container as addon.

I am running Hassio on Raspbian Lite. I have access to a full Linux system and have the freedom to run some other lightweight service if I choose.

Guess I am stuck with keeping it locally for now as I am running HassOS.
thanks for helping though :slight_smile:

1 Like

I am an old Unix admin & have worked some with Linux. That makes these issues easier for me to work on.

I would be careful what you put here.
Most of the consumer routers that have this function also have some hardcoded backdoor or other vulnerability.

I see. Thanks for the heads up. I’ll find another solution :slight_smile:

Try a raspberry pi You can easily setup network shares to usb drives

Thanks. I will look into that =)

You need to mount the remote share, like (from memory)

mount -t cifs //server/share /mntpoint

In HassOs? That is using the SAMBA client which is not likely in a stripped down OS.

That would work for a full Linux installation like Raspbian Lite.

I admit I have not tested if cifs is available in hassos. mount obviously will be.

Hi! Im the exatly same idea to move the hassio’s db (mariadb) on hdd with fritzbox router… you had a solution ? :slight_smile: thankyou

Seriously, I’m not sure it’s a good idea regarding performance.
Local sdcard VS remote smb disk ?

Maybe doing backup on smb is better.


What do yoyr performance ttests show?

Don’t need to do this test, a local db will always more fast than a db on remote disk.
Plus SMB doesn’t seem to be the good protocol for db hosting.

If you have a wrt friendly router or a NAS, you can host a SQL (or whatever) server. (Or a Pi)

Just my point of view :joy_cat:

Can you flash wrt on your router ?

That depends on how fast your local disk is, how fast the network is, what protocol you use, what IO is like on each machine. There are many variables.

Not much of a good protocol for any damn thing. NFS would be superior. Many systems run their entire OS over NFS.

My first statement was local db on sdcard / remote smb with hdd. Easy case :wink:

Completely agree with NFS. (Lol about SMB…)
A db server on a NAS or anything able to run it.

Depending if you need to read all of your data at every connection…
Maybe smb can handle db backup and when you need to read all data you can merge all backups, but on a powerful device, not a Pi.

What do you think about ?