Samba share: Recycle bin does not / never get cleared

  • Hi there!


    My problem is basically the same as described in this thread: Even though I set the option to empty the recycle bin of my Samba shared folder after 31 days it never happens! The recycle bin just keeps growing and growing until I manuelly delete all the files in it.^^ Unlike in the other thread I do not use the Autoshutdown plugin, however.


    Does anyone else also experience this bug? Any ideas on how to investigate this?


    Best,
    Aiakos

  • Did you ever figured this out?


    I have a similar issue. My samba recycle bin does not get cleaned.


    My settings:




    I realized that in /etc/cron.daily/openmediavault-samba-recycle the scripts in the directory /var/lib/openmediavault/cron.d are being run, so effectively it runs:


    /var/lib/openmediavault/cron.dsamba-recycle-xxxxxxx


    Looking at the script and putting a few debugging prints I figured out that the script thinks it is already running:


    # Exit if another job is running.
    [ -e /var/run/samba-recycle-xxxx ] && exit 0


    I have seen that the file truly exists at the specified location (/var/run), however it is not running anymore.
    Maybe some cleanup fails?


    Manually running the script /var/lib/openmediavault/cron.dsamba-recycle-xxxxxxx does clean the recycle bin correctly and /var/run/samba-recycle-xxx gets cleaned up after script termination.
    However everytime I run "run-parts --report /etc/cron.daily", the /var/run/samba-recycle-xxxx file persists.



    I have not done any fancy weird stuff like special ACLs or shutting down the system at a specified time. It runs for weeks but the recycle bin doesn't get cleared...


    Any ideas?

  • Update:


    I asked the question in the debian forums and I got this answer. It looks like the asynchronous call to run-parts will cause the child command to be terminated since the parent / outer command will run the command in background (The &-symbol in "&>"). Mabe we can remove it, or is there any reason for it to run async?


    Also the author of the answer suggests to use mkdir for atomic operations.

  • I having the similar issue.
    I currently have a some files in the recycle bin for my share folder, and I want to empty it manually, but it didn't work.
    When I clicked 'Empty Now', it said "Done." but the files are still there.
    I had to go the the SMB folder, and delete them manually on my Windows 10.


    OMV v3.0.60 x64



    Code
    File: ‘.recycle/’
      Size: 4096            Blocks: 8          IO Block: 4096   directory
    Device: 97fh/2431d      Inode: 139132945   Links: 2
    Access: (2775/drwxrwsr-x)  Uid: (    0/    root)   Gid: (  100/   users)
    Access: 2017-02-12 21:00:29.638945888 -0500
    Modify: 2017-02-13 19:47:15.793533553 -0500
    Change: 2017-02-13 19:47:15.793533553 -0500
     Birth: -

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

    2 Mal editiert, zuletzt von tinh_x7 ()

  • I also had this problem, that the recycle bin was not cleared after the defined time period.


    I found a script in the nas4free forum which deletes the files in recycle bin after a time period, which can be defined within the script.


    In OMV2 the script was executed at shutdown. In OMV3 I didn´t get it to work at shutdown, so I created a hourly cron job for that.

    OMV 3.0.100 (Gray style)

    ASRock Rack C2550D4I C0-stepping - 16GB ECC - 6x WD RED 3TB (ZFS 2x3 Striped RaidZ1) - Fractal Design Node 304 -

    3x WD80EMAZ Snapraid / MergerFS-pool via eSATA - 4-Bay ICYCube MB561U3S-4S with fan-mod

    Einmal editiert, zuletzt von cabrio_leo ()

  • I don't know if my problem is the same as you describe. I can easily reproduce the steps by calling the same script as cron would from the bash command line and it will return to the command line within milliseconds. It clearly didn't remove the files and a glimpse into ".recycle" on the SMB share had confirmed the presentiment. Removing the ampersand mentioned will however resolve the issue I have and the recycle bin gets cleared.


    Can we get the packet maintainer on board? Maybe there is a reason that things are done the way they are now...

  • I have run into the same phenomenon.
    There are various threads regarding this issue on the board. As recent as from last month.
    This one seems to be the most thorough one, though.
    Thanks for starting the debugging on this, 71CHi2OOeuF2.


    To summarize: when automatic samba recycle bin emptying is enabled, OMV creates /var/lib/openmediavault/cron.d/samba-recycle-$uuid:


    Which crond calls daily via /etc/cron.daily/openmediavault-samba-recycle:

    Bash
    #!/bin/sh
    # This configuration file is auto-generated.
    # WARNING: Do not edit this file, your changes will be lost.
    set -e
    run-parts --regex='samba-recycle-*' /var/lib/openmediavault/cron.d &>/dev/null

    The samba-recycle script does various sanity checks, one of which is if the script is already running (by testing for a previously created lockfile):

    Code
    # Exit if another job is running.
    [ -e /var/run/samba-recycle-$uuid ] && exit 0


    From my observations every time I run into the " samba recycle bin emptying not working"-issue, the lockfile exists (preventing any future manual or automatic execution of the recycle script), even though the script is not currently running.
    Manually deleting the lockfile temporarily alleviates the issue.


    Further debugging the scripts I was not able to manually reproduce the conditions that lead to the lockfile /var/run/samba-recycle-$uuid being left over after script termination.
    Any shell magician that could chime in with an insight into what could cause these seemingly sporadic/random issues?



    Edit: as to the ampersand you mentioned, 71CHi2OOeuF2: I don't know why changing I/O redirection (without the &, stderr is no longer redirected to /dev/null) would make any difference on your end.
    At least it does not seem to change or fix the issue for me.

  • Can we get the packet maintainer on board? Maybe there is a reason that things are done the way they are now...

    I assume this is a functionality of the "basic" OMV system. So the maintainer should be @votdev. The official way would be to create a ticket at bugtracker.openmediavault.org

    OMV 3.0.100 (Gray style)

    ASRock Rack C2550D4I C0-stepping - 16GB ECC - 6x WD RED 3TB (ZFS 2x3 Striped RaidZ1) - Fractal Design Node 304 -

    3x WD80EMAZ Snapraid / MergerFS-pool via eSATA - 4-Bay ICYCube MB561U3S-4S with fan-mod

    • Offizieller Beitrag

    I asked the question in the debian forums and I got this answer. It looks like the asynchronous call to run-parts will cause the child command to be terminated since the parent / outer command will run the command in background (The &-symbol in "&>"). Mabe we can remove it, or is there any reason for it to run async?

    Please read the man page for bash I/O redirection, then you will find out that there is nothing async. &> redirects stderr and stdout to the specified file.

  • I would have already raised the issue on the bugtracker, but I cannot reproduce it.
    Is anyone else who has encountered this able to safely reproduce it?


    From the actual script I cannot even fathom any case - except for maybe the server losing power while the script is still running - where the cleanup trap would not be sprung.
    Yet the lockfile was again present on my 24/7 server this evening, with all the above listed consequences.
    Puzzling..

  • I would have already raised the issue on the bugtracker, but I cannot reproduce it.
    Is anyone else who has encountered this able to safely reproduce it?


    From the actual script I cannot even fathom any case - except for maybe the server losing power while the script is still running - where the cleanup trap would not be sprung.
    Yet the lockfile was again present on my 24/7 server this evening, with all the above listed consequences.
    Puzzling..


    I don't have time to investigate on this issue now. I have created a cronjob that deletes everything in /var/run/samba-recycle* daily.


    Further things you might check:


    1) Change the shebang line to /bin/bash instead of /bin/sh
    2) Try looking at the following post, maybe it has something to do with it?
    https://stackoverflow.com/ques…tion-and-trap-exit-signal

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!