pi-hole / FTL

The Pi-hole FTL engine
https://pi-hole.net
Other
1.37k stars 197 forks source link

Disk shortage warning appears even when there is plenty of disk space #1306

Closed bitboxx closed 2 years ago

bitboxx commented 2 years ago

Versions

Platform

Expected behavior

Actual behavior / bug

Steps to reproduce

Steps to reproduce the behavior:

  1. Run Pi-hole docker container with volume mount
  2. Have a large FTL.db file
  3. Login to pi hole web admin
  4. Get disk shortage warnings

Example docker-compose.yml

version: '3'

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    shm_size: 4g
    ports:
      - '53:53/tcp'
      - '53:53/udp'
      - '67:67/udp'
      - '80:80/tcp'
      - '443:443/tcp'
    environment:
      TZ: 'Europe/London'
      WEBPASSWORD: 'pihole'
      ServerIP: '10.10.0.11'
      DNSMASQ_LISTENING: 'all'
    volumes:
      - './config/etc-pihole/:/etc/pihole/'
      - './config/etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    networks:
      default:
        ipv4_address: 10.10.0.11
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
networks:
  default:
    external:
      name: local-net-static

Debug Token

Screenshots

2022-02-21 20 22 53 pi hole 2fdad67d2421

Additional context

Possible cause could be this commit: https://github.com/pi-hole/FTL/commit/4c2c59b21417292ffe6316cb30d4c123a2d0e33a

yubiuser commented 2 years ago

Are those numbers correct? FTL warns if more than 90% are used, which is the case here. It does not consider the total amount of space left for its warning.

bitboxx commented 2 years ago

The numbers are correct, but the 91% used is not. there is 320GB free disk space. Please have a look my debug log https://tricorder.pi-hole.net/hO5lzDxy/

yubiuser commented 2 years ago

What base OS are you using? MacOS?

bitboxx commented 2 years ago

I'm running Ubuntu as Docker host.

Is the full disk warning triggered by a percentage btw? The mounted volume on the PiHole Docker container is a 4TB drive and it has about 320GB left, so that's 91% disk utilization. So it's almost full in terms of percentage, but still plenty of space for PiHole purposes.

*** [ DIAGNOSING ]: Disk usage
   Filesystem      Size  Used Avail Use% Mounted on
   /dev/md0        3.6T  3.1T  315G  91% /etc/pihole
rdwebdesign commented 2 years ago

Is the full disk warning triggered by a percentage btw?

Yes. Usage above 90% will trigger the warning. This not a bug. It's just a real warning.

Documentation: https://docs.pi-hole.net/ftldns/configfile/#check_disk

dschaper commented 2 years ago

I understand the concern though. 90% of a 4TB disk is a whole lot of space and having that warning is a bit much. Can we look at doing something with either available space or available inodes?

rdwebdesign commented 2 years ago

Sorry if my answer sounded quick or too superficial. I understand your point.

In the meantime, you can set CHECK_DISK to a higher value (95 or 98), or you can disable the warning setting it to zero (inside /etc/pihole/pihole-FTL.conf). This way the warning will only appear when the new limit is reached (see documentation).

Example:

CHECK_DISK=95
bitboxx commented 2 years ago

Thanks for the suggested fix @rdwebdesign. I've disabled the disk space warning in my setup CHECK_DISK=0.

IMHO, Pi-Hole if setup as a Docker container should not be concerned about disk space, temperature, etc. Furthermore, the implementation of disk space warning using disk free percentage alone... is a naive one and could be improved.

DL6ER commented 2 years ago

is a naive one and could be improved.

Any practical suggestions? Using a percentage seems like a reasonable measure to me because of several points. A percentage assumes you have good reasons for using a disk as large as you have because of the number and type of applications you host here. For instance, if you're running your Pi-hole on a device that has 4 TB of disk space, it's pretty likely that you are not giving this disk space alone to Pi-hole but are also hosting a NAS (or similar) on the same device. Why you managed to fill it up to 90% by now, you may end up filling it to the brim some moments later. And all this without Pi-hole being responsible for this but still being able to get hit by you copying some movies onto the disk which eventually wipes out all the remaining disk space at once. Hence, it isn't all that simple to say "well, 8 GB of disk space left is still okay". It may just be too late for a warning in this case. And if you disagree, that's fine. Everything is customizable.

bitboxx commented 2 years ago

@DL6ER What about triggering the disk space notification based on an X MB of storage left instead of a percentage? EG. 200MB disk space

My Pihole is running as a Docker container on a NAS drive. The config directory is a volume mount as described by this docker-compose.yml file:

version: '3'
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    shm_size: 4g
    ports:
      - '53:53/tcp'
      - '53:53/udp'
      - '67:67/udp'
      - '80:80/tcp'
      - '443:443/tcp'
    environment:
      TZ: 'Europe/London'
      ServerIP: '10.10.0.11'
      DNSMASQ_LISTENING: 'all'
    volumes:
      - './config/etc-pihole/:/etc/pihole/'
      - './config/etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    networks:
      default:
        ipv4_address: 10.10.0.11
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
PromoFaux commented 2 years ago

I've disabled the disk space warning in my setup CHECK_DISK=0.

Just as an FYI, you can also do this with an env var:

environment:
  FTLCONF_CHECK_DISK: 0
github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.