INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How does MC Linux detects an unmounted volumen when auto-importing ?  (Read 1373 times)

Gedeon

  • World Citizen
  • ***
  • Posts: 105

I'm already using MC25, but I'm ineterested in which is the MC criteria to "not remove" MC tracks, video files from the database if not found under a non-mounted path (like the Windows feature to keep content indexed from eventually unreachable drives)
Logged

Gedeon

  • World Citizen
  • ***
  • Posts: 105
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #1 on: October 04, 2020, 02:58:46 pm »

I just want to understand under which circumstances (if any), in a Linux system, when MC doesn't found files in its database path just decides that there aren't missing/erased files but an unmounted disc, so auto-import won't delete those files from the database.

¿ Is it any policy about it or in Linux it just erase from database every not found file when auto-importing ?

Thanks in advance.
Logged

Gedeon

  • World Citizen
  • ***
  • Posts: 105
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #3 on: October 05, 2020, 07:01:36 am »

https://wiki.jriver.com/index.php/Auto-Import
https://wiki.jriver.com/index.php/Fix_Broken_Links


I know those, I'm just asking how MC determines un Linux if a file is deleted or if the volume isn't mounted, so on this last case It wouldn't remove the file from the database.

Linux paths aren't like Window ones. I can be tricky if MC only saves the path without any metadata about the mount point or the volume UUID.

Maybe a flag-file could help if not already implemented.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #4 on: October 05, 2020, 07:54:10 am »

Don't know if undocumented linux behaviour exists but fix broken links wiki states:

"Yes (protect files on missing drives)
    The default. This is the same as Yes, except for that files are "protected" if MC determines that drive is entirely missing.

The Protect files on missing drives option is useful with external and network volumes (such as USB drives or NAS devices) that may sometimes be disconnected or offline. With this option enabled, when it finds missing files, Auto-Import will try to determine if the drive itself is entirely offline, or if the drive exists but the files are actually missing, and only remove them in the latter case. This is important if your drive might go offline occasionally because otherwise Media Center would happily remove all files on a drive when it becomes disconnected! Please note that the OS does not always provide a clean way to make this determination and this setting is not 100% foolproof. If you experience difficulty with files on external or network volumes being removed from and re-imported into Media Center, disable this setting entirely. "



Devs can of course give more specific answer if linux differs from documentation. I would just set it off and do deletions only inside MC to keep sync.
Logged

Gedeon

  • World Citizen
  • ***
  • Posts: 105
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #5 on: October 05, 2020, 08:02:52 am »

Don't know if undocumented linux behaviour exists but fix broken links wiki states:

"Yes (protect files on missing drives)
    The default. This is the same as Yes, except for that files are "protected" if MC determines that drive is entirely missing.

The Protect files on missing drives option is useful with external and network volumes (such as USB drives or NAS devices) that may sometimes be disconnected or offline. With this option enabled, when it finds missing files, Auto-Import will try to determine if the drive itself is entirely offline, or if the drive exists but the files are actually missing, and only remove them in the latter case. This is important if your drive might go offline occasionally because otherwise Media Center would happily remove all files on a drive when it becomes disconnected! Please note that the OS does not always provide a clean way to make this determination and this setting is not 100% foolproof. If you experience difficulty with files on external or network volumes being removed from and re-imported into Media Center, disable this setting entirely. "



Devs can of course give more specific answer if linux differs from documentation. I would just set it off and do deletions only inside MC to keep sync.


Do you have Linux and you have tested this behaviour ?
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #6 on: October 05, 2020, 08:16:58 am »

Only as clients so can't confirm if Linux behaviour. I keep this as "No" on Windows as well as I feel it is safer that way. Then again I have configured auto-import only for TV series as music will need my tag modifications any way so I import them while doing tagging
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #7 on: October 05, 2020, 09:09:14 am »

So my server runs on Linux and has been running on Linux for about year, and I currently have this specific setting enabled.  I haven't specifically "crash tested" the setting on Linux (say by force unmounting my media network share and manually running import), but I haven't experienced any spontaneous deletions of library items either.  Generally speaking all my media is on NAS drives mounted through CIFS, and my NAS drives are usually available, but my NAS has gone down temporarily in that time and I haven't seen MC removing my entire library.

I'm not a dev, so I don't know exactly how MC tests, but one thing to know about my config:  I did not add the root of my drive mount to my auto-import list, I only added sub directories within the drive mount.  For example, I did not add /mnt/media to the auto-import list, instead I added /mnt/media/Audio and /mnt/media/Video, etc. 

This may be important because if MC tries to stat either of those subdirectories with the network drive unmounted, it will get a "no such file or directory" which, when you're talking about the root directory for scanning, probably signifies a missing drive.  If you instead setup auto-import to watch the root (/mnt/media in my case), that directory will be there whether the drive is mounted or not.  So the stat would show a directory there, which, when the drive is umounted, would be empty.  In that case it's possible that a missing drive could lead to mass "fixing" of broken links! 

Again I don't know how the detection actually works on Linux, I only know I use the setting and haven't had any issues with the configuration described above.
Logged

Gedeon

  • World Citizen
  • ***
  • Posts: 105
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #8 on: October 05, 2020, 11:11:03 am »

I'll test that approach this afternoon. Referencing only the root folder doesn't seem to work, so entries are deleted when non mounted.
Logged

max096

  • MC Beta Team
  • Galactic Citizen
  • *****
  • Posts: 363
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #9 on: October 05, 2020, 11:27:00 am »

You can test what it does very simply make a new library copy some songs on a USB stick or something mount that import unmount see what it does.

It should not end up deleting your songs from the library. If it does there is room for improvement as people will use MC with network mounts that may have downtimes.

Its not hard to figure out programatically if a directory has something mounted to it and if thats suddenly no longer the case deleting everything would be bad. Wether or not there is a directory or not does not really matter.

However jriver does automatic backups so at least you could restore it easiely if things go wrong.

Can't currently verify any specific behavior either. Could try later. Expecting it to work though.
Logged

Gedeon

  • World Citizen
  • ***
  • Posts: 105
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #10 on: October 05, 2020, 02:24:04 pm »

I've just checked only adding the subfolders below the mount point, after that I unmounted the volume and run autoimport. All files were removed.

Obviously I made a backup before that which I restored after the test.

So no idea about how is in Linux implemented that volume detection.
Logged

Zhillsguy

  • Galactic Citizen
  • ****
  • Posts: 325
Re: How does MC Linux detects an unmounted volumen when auto-importing ?
« Reply #11 on: October 06, 2020, 08:30:45 pm »

If I'm not mistaken (at least in the Win version) if you manually initiate the import the entries are removed from the library, otherwise they aren't. Worth a shot.
Logged
Ryzen 5 W11 x64 MC 29 HTPC/Server and HP G2 Mini Elitedesk W11 MC 29 (music only zone), various Android Phones and Tablets for control of both, powering two lanai surround systems, 5.1 and 4.1 respectively.
Pages: [1]   Go Up