itzg / minecraft-server-charts

MIT License
279 stars 144 forks source link

Excessive use of free storage on a volume #234

Open SyntaxJuggler opened 1 month ago

SyntaxJuggler commented 1 month ago

I'm using Kubernetes to host a minecraft server. I install the server assembly using generic pack and I have a problem that every reboot it is downloaded again, saved in that and exits so I spend 1 gig of space per restart, how can I fix this?

itzg commented 1 month ago

To clarify are you concerned about the downloaded files it keeps in /data/packs or the download bandwidth from re-downloading?

SyntaxJuggler commented 1 month ago

I’m generally concerned about the disk space usage on the volume. When I accessed the pod and checked the total size of everything in the root directory, I got a value of 4.6G, while in the control panel the volume actually shows 7.71 Gi. I don’t quite understand where this difference comes from. I also noticed that this memory increase only happens during the server restart, possibly because the program installs a package but doesn't clean up the data.

itzg commented 1 month ago

I don't understand the difference either. The only part I can possibly address is the /data directory within the container. Please exec du -h -d 1 /data within the container and investigate the directory sizes reported with that.

SyntaxJuggler commented 1 month ago
minecraft@technomagic-minecraft-c48449468-745r8:/$ du -h -d 1 /data
4.0K    /data/.tmp
20M     /data/config
144K    /data/.cache
92K     /data/resourcepacks
4.0K    /data/patchouli_books
720M    /data/packs
160M    /data/libraries
16K     /data/lost+found
120K    /data/defaultconfigs
567M    /data/world
6.3M    /data/logs
2.3G    /data/simplebackups
771M    /data/mods
308K    /data/kubejs
7.6M    /data/mod_data
24K     /data/local
4.6G    /data
minecraft@technomagic-minecraft-c48449468-745r8:/$

image

Perhaps in that sense, not only the data folder but also others because subPath is not specified in the helm chart

persistence:
  labels: {}
  annotations: {}
  ## specify an alternative volume to be mounted to /data instead of datadir.
  # altDataVolumeName: ""
  ## minecraft data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  storageClass: "longhorn"
  dataDir:
    # Set this to false if you don't care to persist state between restarts.
    enabled: true
    Size: 12Gi
    accessModes:
      - ReadWriteMany
    # existingClaim: nil
    ## specify a subpath in the volume where the data is. Useful when sharing volumes with other apps.
    # subPath: /path/to/dataDir
itzg commented 1 month ago

Sorry, I have no further ideas. Since you're not using subPath then the root of that volume is attached at the container's /data. Perhaps you need to investigate the persistence provider for the storage class "longhorn" -- it's quite likely that is due to snapshots and other features they mention: https://longhorn.io/