Schaka / janitorr

Cleans your Radarr, Sonarr, Jellyseerr and Jellyfin before you run out of space
GNU General Public License v3.0
313 stars 7 forks source link

Perms issue? Free disk space: NaN% #33

Closed brookesy2 closed 6 months ago

brookesy2 commented 6 months ago

Oddly getting the below, even though the user can see everything it needs to see.

2024-04-09T05:07:56.522Z INFO 1 --- [ scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule : Free disk space: NaN%

Schaka commented 6 months ago

What happens if you do du or df / on the directory you're pointing it to for disk space? From within the container, of course.

It could be you haven't set the property correctly or mapped your config correctly.

All I do is use Java's implementation of the File api to read disk space. Could be a bug with the ARM image, but I doubt it

brookesy2 commented 6 months ago

Thanks for the speedy response! No issue with df it seems, from within the container.

root@0a8949da0f17:/# df -h data Filesystem Size Used Avail Use% Mounted on /dev/sda 2.8T 1.1T 1.7T 39% /data

Schaka commented 6 months ago

Then I will need more info to debug this. Your application.yml file, a full log, etc. Also, assuming you are on the latest image and it's actually updated?

The code I use to determine disk space is:

val filesystem = File(fileSystemProperties.freeSpaceCheckDir)
return (filesystem.freeSpace.toDouble() / filesystem.totalSpace.toDouble()) * 100

You could also try this yourself if you can run a container with JShell.

brookesy2 commented 6 months ago

Thanks for taking the time to look. Trace level debugging is on, this is all I see.

Log (basically this just repeats).

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.2.4)

2024-04-09T04:59:56.630Z  INFO 1 --- [           main] c.g.s.janitorr.JanitorrApplicationKt     : Starting JanitorrApplicationKt using Java 21.0.2 with PID 1 (/app/classes started by root in /)

2024-04-09T04:59:56.631Z  INFO 1 --- [           main] c.g.s.janitorr.JanitorrApplicationKt     : No active profile set, falling back to 1 default profile: "default"

2024-04-09T04:59:57.083Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8978 (http)

2024-04-09T04:59:57.088Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

2024-04-09T04:59:57.088Z  INFO 1 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.19]

2024-04-09T04:59:57.105Z  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext

2024-04-09T04:59:57.105Z  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 450 ms

2024-04-09T04:59:57.593Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8978 (http) with context path ''

2024-04-09T04:59:57.598Z  INFO 1 --- [           main] c.g.s.janitorr.JanitorrApplicationKt     : Started JanitorrApplicationKt in 1.123 seconds (process running for 1.236)

2024-04-09T04:59:57.611Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Not deleting Shows because minimum disk threshold was not reached.

2024-04-09T04:59:57.611Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Free disk space: NaN%

2024-04-09T04:59:57.611Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Not deleting Movies because minimum disk threshold was not reached.

2024-04-09T04:59:57.611Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Free disk space: NaN%

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Not deleting Shows because minimum disk threshold was not reached.

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Free disk space: NaN%

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Not deleting Movies because minimum disk threshold was not reached.

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Free disk space: NaN%

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Not deleting Shows because minimum disk threshold was not reached.

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Free disk space: NaN%

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Not deleting Movies because minimum disk threshold was not reached.

2024-04-09T04:59:57.612Z  INFO 1 --- [   scheduling-1] c.g.s.j.cleanup.AbstractCleanupSchedule  : Free disk space: NaN%

application.yaml. Everything is the same as the default, except the obvious areas of change. I have left off the clients object for obvious reasons :)

logging:
  level:
    com.github.schaka: TRACE
server:
  port: 8978

# File system access (same mapping as Sonarr, Radarr and Jellyfin) is required to delete TV shows by season and create "Leaving Soon" collections in Jellyfin
# Currently, Jellyfin does not support an easy way to add only a few seasons or movies to a collection, we need access to temporary symlinks
# Additionally, checks to prevent deletion on currently still seeding media currently require file system access as well
file-system:
  access: true
  validate-seeding: true # validates seeding by checking if the original file exists and skips deletion - turning this off will send a delete to the *arrs even if a torrent may still be active
  leaving-soon-dir: "/mnt/data/leaving-soon" # A directory this container can write to and Jellyfin can find under the same path - this will contain new folders with symlinks to files for Jellyfin's "Leaving Soon" collections
  from-scratch: true # Clean up entire "Leaving Soon" directory and rebuild from scratch - this can help with clearing orphaned data - turning this off can save resources (less writes to drive)
  free-space-check-dir: "/mnt/data/" # This is the default directory Janitorr uses to check how much space is left on your drives. By default, it checks the entire root - you may point it at a specific folder

application:
  dry-run: true
  leaving-soon: 14d # 14 days before a movie is deleted, it gets added to a "Leaving Soon" type collection (i.e. movies that are 76 to 89 days old)
  exclusion-tag: "janitorr_keep" # Set this tag to your movies or TV shows in the *arrs to exclude media from being cleaned up

  media-deletion:
    enabled: true
    movie-expiration:
      # Percentage of free disk space to expiration time - if the highest given number is not reached, nothing will be deleted
      # If filesystem access is not given, disk percentage can't be determined. As a result, Janitorr will always choose the largest expiration time.
      5: 15d # 15 days
      10: 30d # 1 month - if a movie's files on your system are older than this, they will be deleted
      15: 30d # 2 months
      20: 90d # 3 months
    season-expiration:
      5: 15d # 15 days
      10: 20d # 20 days - if a season's files on your system are older than this, they will be deleted
      15: 60d # 2 months
      20: 120d # 4 months
Schaka commented 6 months ago

In your application.yml, you're using "/mnt/data", when using df it's just /data. Did you execute df from inside the container, i.e. docker exec -it janitorr df -h?

If pointed towards the wrong directory, Java will just show 0. image

Edit: If you add your docker-compose or run command that'll help too.

brookesy2 commented 6 months ago

Omg, I'm so sorry for wasting your time. I was obviously using the actual path and not the mapped path!! Thanks for all the great work on this!