# Free Up Pi-Hole Disk Space Usage

## Cleaning Log Files

1. Log into the Pi-Hole server
2. Run the following commands in a terminal window
   # output current pihole db size
   sudo du /etc/pihole/pihole-FTL.db -h
   # flush pihole logs
   pihole flush
   # stop pihole FTL service
   sudo systemctl stop pihole-FTL
   # delete the FTL database file
   sudo rm /etc/pihole/pihole-FTL.db
   # stop pihole FTL service
   sudo systemctl start pihole-FTL
   # output reduced pihole db size
   sudo du /etc/pihole/pihole-FTL.db -h

## Reduce Long Term Log Lifespan

By default, Pi-hole keeps long term DNS logs for 365 days. This lifespan can be changed by altering the MAXDBDAYS variable in /etc/pihole/pihole-FTL.conf

1. To reduce the log lifespan, run the following commands in a terminal window
   # edit pihole-FTD.conf
   sudo nano /etc/pihole/pihole-FTL.conf
2. Add or edit MAXDBDAYS value in the configuration file as needed
3. Press CTRL+O, Enter, CTRL+X to write the changes
4. Continue with the following command
   # restart pihole-FTL server
   sudo systemctl restart pihole-FTL
5. After restarting the service the new logs lifespan will be active

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