How to handle migrating external HDDs from local to network/smb?

Let me sketch the situation:

I have an rpi3 with OSMC installed and hooked up to the TV, there are 2 external HDDs hooked up to it that automatically get mounted to /media/ by OSMC.

I have an rpi4 as home automation server in the basement next to the ISP router.

Now what I would like to do is move those 2 external HDDs from the rpi3 to the rpi4 so I don’t have the noise of them spinning in the living area. I believe the best way to do so is use samba? Any tips there?

Should I assume that I will need to wipe the entire media library in OSMC/Kodi and have it re-index everything once the samba shares are available on the rpi3 or is there a way to tell OSMC both drives are not in /media anymore but in the path wherever samba shares appear?

Well the most “native” way to share between two Linux machines would be NFS. Unless you also want to access the drives from other systems.
In that case just install samba server on the Pi one and configure it to share the two drives (config is in /etc/samba/smb.conf)

No either you can use fstab/autofs to mount the shared samba drives into the same directory under /media they are mounted currently.
Alternatively you could use path substitution to match from the new to the old folders.

1 Like

Should only be between the 2 rpi’s and perhaps OSX, I’l give NFS a try, thanks.

Today I tried this. The mounting with nfs worked well however after a reboot, since I mount on OSMC in the /media folder, the folder to mount the nfs drive in is purged (as what the README in the /media folder says).

Any way to stop that purging or an easy way to change all paths from /media/MyDrive to /mnt/MyDrive ?

Unmount the drive, and then in the /media/mountpoint folder just create an empty file.

sudo touch /media/mountpoint/donotremoveme

Then the directory won’t be removed on a reboot.

If you want to switch to mounting the drive in /mnt then you could use path substitution so you don’t have to rebuild your library. Personally, when I originally setup my system I used /media and just used the empty file method, and have stuck with that.