Jellyfin Forum
Removable drive management - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Removable drive management (/t-removable-drive-management)



Removable drive management - yak - 2024-04-14

Hey there, I'm on Linux and I have my movies collection on a removable drive.
The problem is that if I use my laptop without the drive connected, the next time I'll connect it and open Jellyfin my library is empty. So I have to rescan, which is not a big deal.
The big deal though is that everytime I do this rescan, the movies are reloaded without my customized metadata, so I have to identify again every uncorrectly identified movie, and I lost every customization related to images, posters, ecc. The only information that seems to remain is the "watched" tick. Everything else needs to be done from scratch.

Is this supposed to happen? And is there a way to not lose all my metadata, and possibily not having to rescan my library everytime I use my computer without my hard drive connected?


RE: Removable drive management - TheDreadPirate - 2024-04-15

When you use the laptop without the drive, is Jellyfin still running in the background? If so, this behavior is expected. As for the metadata, also expected when it is re-added. When you disconnect the drive make sure that Jellyfin has stopped before doing so. You can also have Jellyfin write NFOs and make them read only to preserve metadata.


RE: Removable drive management - yak - 2024-04-15

(2024-04-15, 01:59 AM)TheDreadPirate Wrote: When you use the laptop without the drive, is Jellyfin still running in the background?

It is. It runs automatically at every boot.

(2024-04-15, 01:59 AM)TheDreadPirate Wrote: When you disconnect the drive make sure that Jellyfin has stopped before doing so.

Is there some easy way to make Jellyfin start only if the drive is connected?
I mean, when I disconnect it Jellyfin is always stopped, the problem is that, being my computer a laptop, there are some times which I use it outdoor and I don't have the drive with me. At boot the service starts anyway and so the next time I'll boot it with the drive connected this problem happens. So having away to prevent the service to start Jellyfin if the drive isn't connected seems to be necessary in this case. Or what's the best way to deal with this scenario?

(2024-04-15, 01:59 AM)TheDreadPirate Wrote: You can also have Jellyfin write NFOs and make them read only to preserve metadata.

Actually this seems to be the best way! Could you point me to a guide to do so, please?
This wouldn't prevent me to have to rescan library though, right?


RE: Removable drive management - Efficient_Good_5784 - 2024-04-15

(2024-04-15, 07:32 AM)yak Wrote:
(2024-04-15, 01:59 AM)TheDreadPirate Wrote: You can also have Jellyfin write NFOs and make them read only to preserve metadata.

Actually this seems to be the best way! Could you point me to a guide to do so, please?
This wouldn't prevent me to have to rescan library though, right?
You'll have to write a script or cron job that does this for you. It's a simple enough task.
If your server is on Linux, just have a script periodically chmod the nfo files in a directory to only allow the Jellyfin user to read them only.

Basically a "chmod 440" applied to the nfo files if you want to make owner & group all have read-only access.


RE: Removable drive management - yak - 2024-04-15

(2024-04-15, 08:20 AM)Efficient_Good_5784 Wrote:
(2024-04-15, 07:32 AM)yak Wrote:
(2024-04-15, 01:59 AM)TheDreadPirate Wrote: You can also have Jellyfin write NFOs and make them read only to preserve metadata.

Actually this seems to be the best way! Could you point me to a guide to do so, please?
This wouldn't prevent me to have to rescan library though, right?
You'll have to write a script or cron job that does this for you. It's a simple enough task.
If your server is on Linux, just have a script periodically chmod the nfo files in a directory to only allow the Jellyfin user to read them only.

Basically a "chmod 440" applied to the nfo files if you want to make owner & group all have read-only access.

Thank you. Isn't this the same thing as ticking the "Lock this item to prevent future changes" box, in Jellyfin's GUI?

Edit: I mean, I know it's not exactly the same thing, but doesn't it have basically the same effect?


RE: Removable drive management - TheDreadPirate - 2024-04-16

(2024-04-15, 07:32 AM)yak Wrote:
(2024-04-15, 01:59 AM)TheDreadPirate Wrote: When you use the laptop without the drive, is Jellyfin still running in the background?

It is. It runs automatically at every boot.

Then the problem you are having is 100% expected.  Stop Jellyfin BEFORE disconnecting the drive and disable auto-start on boot.

(2024-04-15, 07:32 AM)yak Wrote:
(2024-04-15, 01:59 AM)TheDreadPirate Wrote: When you disconnect the drive make sure that Jellyfin has stopped before doing so.

Is there some easy way to make Jellyfin start only if the drive is connected?
I mean, when I disconnect it Jellyfin is always stopped, the problem is that, being my computer a laptop, there are some times which I use it outdoor and I don't have the drive with me. At boot the service starts anyway and so the next time I'll boot it with the drive connected this problem happens. So having away to prevent the service to start Jellyfin if the drive isn't connected seems to be necessary in this case. Or what's the best way to deal with this scenario?


Depends.  If this is Linux you can have the Jellyfin service ensure that a drive is mounted before starting.  If this is Windows, I'm not aware of a way to do that.

(2024-04-15, 07:32 AM)yak Wrote:
(2024-04-15, 01:59 AM)TheDreadPirate Wrote: You can also have Jellyfin write NFOs and make them read only to preserve metadata.

Actually this seems to be the best way! Could you point me to a guide to do so, please?
This wouldn't prevent me to have to rescan library though, right?

You have to enable NFO saver in the library settings in Jellyfin.  If Jellyfin has already scanned your library you will need to rescan and select "replace all metadata" to trigger NFOs to be written.  After they are written and any mis-identifications corrected, you will need to ensure that the resulting NFOs are read-only to Jellyfin.  In Linux, as Efficient suggested, change the file permissions to 440 or something similar.

Selecting "lock metadata" will only prevent changes to content already in your library.  For the problem you are having, assuming you don't heed my advise to stop Jellyfin, locking the metadata doesn't apply to "new" content.


RE: Removable drive management - yak - 2024-04-16

(2024-04-16, 08:48 PM)TheDreadPirate Wrote: Depends.  If this is Linux you can have the Jellyfin service ensure that a drive is mounted before starting.  If this is Windows, I'm not aware of a way to do that.
 
It's Linux. Starting the service only if the drive is mounted would be perfect. Do you have any advice how to edit the service in order to achieve that?

(2024-04-15, 01:59 AM)TheDreadPirate Wrote: you will need to ensure that the resulting NFOs are read-only to Jellyfin.
I did it and now it works perfectly. Just curious though, why does it need to be read-only to Jellyfin?
Anyway, thank you.


RE: Removable drive management - TheDreadPirate - 2024-04-17

From experience, Jellyfin will still try to find online metadata and overwrite existing NFOs. The only way to ensure it doesn't do this is to make them read only for the jellyfin service user.

This stackexchange post should answer you question about ensuring a mount exists before starting a service.

https://unix.stackexchange.com/questions/654112/wait-for-mount-before-starting-services