OSMC Backup to SMB NAS

Hi all,

I’ve spend a good few hours trying to work this out and looking at pervious posts but sadly now need to ask for a dummy’s guide to do what I’m looking to achieve.

I have a NAS with a shared folder called OSMC (smb) with RW access with username and password.
I’d like OSMC backups to save to that location.
I assume you need to automount that folder to something like /mnt/backup and then set that as the backup location?

Any help greatly appreciated.

For refer… I tried adding to fstab

//192.168.1.100/OSMC /mnt/osmc cifs uid=0,credentials=/home/osmc/.smbcredentials,iocharset=utf8,vers=3.0,noperm 0

creds: nano ~/.smbcredentials

EDIT 1:
Above appears to create a folder osmc under /mnt

osmc@osmc-vero5:~$ ls -l /mnt/
drwxr-xr-x 2 root root 4096 Sep  1 07:30 osmc

When I try set OSMC backup location to /mnt/osmc
I get this message - Make sure the selected folder is writable and that the new folder name is valid

When I try set the backup location to the network location directly i get this error message - backup failed to copy the tar file

EDIT 2:
Local Backup works to /home/backup

Personally, I don’t use any OS-level network mounts, and just use passwords.xml in Kodi to translate the fake path in Kodi to the real path of the NAS, which includes the username/password. Not secure as the username/password is stored in plain text, but the account I use is very locked down on the NAS and could really only delete OSMC backup files (but my NAS protects them internally). It’s got read-only access to my media files, so a hacker could look at those if they really wanted to :man_shrugging:

So my passwords.xml file is along the lines of this:

<passwords>
    <path>
        <from pathversion="1">smb://[Name_For_NAS_In_Kodi]</from>
        <to pathversion="1">smb://[NAS_username]:[NAS_password]@[NAS_IP_Address]</to>
    </path>
</passwords>

Example:

<passwords>
    <path>
        <from pathversion="1">smb://MyNAS</from>
        <to pathversion="1">smb://osmcuser:osmcPassword1@192.168.1.2</to>
    </path>
</passwords>

Then I can just use

smb://[Name_For_NAS_In_Kodi]

From above Example:

smb://MyNAS

for the start of any source in Kodi, backup location in OSMC, etc. and it all works.
I use the Emby plugin with direct paths, and that all works fine too (with a small bit of configuration).
This is translatable to any Kodi platform, so not just for OSMC.
I use IP address in the translation to remove any requirement for name resolution (DNS, etc.), but then my NAS needs (and has) a static IP address.

Make sure you update to OSMC August 2024 Update (with Kodi 21.1) to make sure backups in OSMC work correctly to a NAS: otherwise you may well get this error message when backing up to a NAS location.

1 Like

Maybe try something like…

//192.168.1.100/OSMC /mnt/osmc cifs x-systemd.automount,noauto,rw,iocharset=utf8,credentials=/home/osmc/.credentials,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=3.0 0 0

but autofs is a better way than fstab and if you wanted to go that route I’d suggest to check out the following guide…

Also it would be prudent to actually check you can write to the mount at the terminal before bothering with the backup utility in Kodi…

touch /mnt/osmc/write-test && ls -la /mnt/osmc

That being said a system mount isn’t necessary. I’d suggest to go to settings>file manager>add source>browse>add network location> and enter only your server name and credentials. At this screen leave the shared folder empty. After you click “OK” on that screen you should now have this as a location in the browse list. You can choose to add your mount point or not as a source to file manager (note sources in file manager are a different set than the library sources). When you go back to the backup location setting in the My OSMC add-on and browse you should see the new location available to navigate into (if you already have a path set you may need to click the up folder navigation button to get back to the top level where you can see it).

1 Like