How to Keep your Raspberry Pi happy Tips and tricks to maintain your Raspberry Pi for optimal performance and longevity. 30 August 2025 8 minute read By Share this article on Table of Contents 10 Raspberry Pi Tips for a Happier Pi1. Removing large files2. Keeping your system updated3. Backing upUsing Crontab4. Monitoring system performance with htop5. Cleaning up the file systemJournalctl6. Power Supply7. Cooling8. Use surge protection9. Change default passwords10. Document your setup11. Bonus Ansible script Tags: raspberry pi software Difficulty: beginner Category: raspberrypi software productivity Home Blog How to keep your raspberry pi happy How to Keep your Raspberry Pi happy Tips and tricks to maintain your Raspberry Pi for optimal performance and longevity. 30 August 2025 | 8 minute read | By | Share this article on Page last updated 30 August 2025 10 Raspberry Pi Tips for a Happier Pi Removing large files Keeping your system updated Backing up Monitoring system performance with htop Cleaning up the file system - force the maintenance scripts to run immediately, and a bit of background about what the maintenance scripts are, how often they run, what they do and what they leave behind Power Supply - use a good quality power supply to avoid issues Cooling - consider using heatsinks or fans to keep your Raspberry Pi cool, especially under heavy load Use surge protection – Plug your Pi into a surge protector to protect it from power spikes and outages. Change default passwords – Always change the default password for your Pi to keep it secure from unauthorized access. Document your setup – Keep notes on your configurations, installed software, and any changes you make. This helps with troubleshooting and future upgrades. Bonus Ansible script – Automate your Raspberry Pi setup and configuration with Ansible for easier management and deployment. 1. Removing large files What’s the problem? Over time, your Raspberry Pi can fill up with large or unnecessary files, which can slow down your system or even cause it to stop working if the SD card is full. How might it present itself? “No space left on device” errors Slow performance Inability to save files or install updates How to resolve it: Find and remove large files you no longer need. How often? Check every 1–2 months, or if you notice storage issues. Step-by-step instructions: Install ncdu: sudo apt install ncdu Run ncdu in your home directory: ncdu ~ Use arrow keys to browse and identify large files/folders Press d to delete unwanted files Empty the trash if you use a desktop environment 2. Keeping your system updated What’s the problem? Outdated software can have security vulnerabilities and bugs. Hackers may use known vulnerabilities to exploit your system, hack it and potentially hijack your computer - the so called ransomware attack. How might it present itself? Security warnings Software crashes Incompatibility with new software How to resolve it: Regularly update your system packages. How often? At least once a month, or when prompted. Step-by-step instructions: Open a terminal Run: sudo apt update Then: sudo apt upgrade -y Reboot if the system asks you to 3. Backing up What’s the problem? SD cards can fail, and accidental deletions or corruption can cause data loss. How might it present itself? Pi won’t boot Missing files Lost configurations How to resolve it: Regularly back up your SD card or important files to another device or cloud storage. How often? Monthly, or before making major changes. Step-by-step instructions: To back up the whole SD card, shut down the Pi and remove the card. Use a card reader on your PC/Mac. Use Raspberry Pi Imager or dd to create an image of the card. For file backups, use rsync or copy important folders to another drive or cloud. Backing up configuration files: To backup the configuration files, you can use the following command: sudo tar -czvf backup.tar.gz /etc Scheduling a backup with crontab To schedule regular backups, you can use cron. Here’s how to set it up: Open the crontab editor: crontab -e Add a line to schedule the backup (e.g., daily at 2 AM): 0 2 * * * sudo tar -czvf /path/to/backup/backup_$(date +\%F).tar.gz /etc Save and exit the editor. Using Crontab Crontab is a time-based job scheduler in Unix-like operating systems. You can use it to schedule tasks to run at specific intervals. For example, you can use crontab to schedule backups, system updates, or any other repetitive task. Crontab format: * * * * * command_to_execute The five asterisks represent different time and date fields: Minute (0-59) Hour (0-23) Day of the month (1-31) Month (1-12) Day of the week (0-7) (Sunday is both 0 and 7) Crontab runs using the system’s cron daemon, which checks the crontab files and executes the scheduled tasks at the specified times. The user account under which the cron job runs may affect its permissions and environment. 4. Monitoring system performance with htop What’s the problem? Resource-heavy processes can slow down your Pi or cause it to freeze. How might it present itself? Slow response High CPU temperature Unresponsive programs How to resolve it: Monitor system resources and identify problematic processes. How often? Check when you notice slowness or monthly as a checkup. Step-by-step instructions: Install htop: sudo apt install htop Run: htop Look for processes using high CPU or memory Use F9 to kill a process if needed 5. Cleaning up the file system What’s the problem? Temporary files and file system fragmentation can waste space and slow down your Pi. How might it present itself? Disk space shrinking over time Slower file access How to resolve it: Run file system maintenance scripts to clean up and optimize storage. How often? Every 1–2 months, or if you notice storage issues. Step-by-step instructions: To trim unused blocks (on SSDs/SD cards): sudo fstrim -av To clear apt cache: sudo apt clean To remove old logs: sudo journalctl --vacuum-time=2weeks To run all maintenance scripts: sudo systemctl start fstrim.timer Journalctl Journalctl is a command-line tool for querying and displaying messages from the journal, managed by systemd. It provides a way to view logs from the systemd journal, which includes logs from the kernel, system services, and user applications. The vacuum command is used to remove old journal logs and free up disk space. It normally runs automatically, every time the system boots. 6. Power Supply What’s the problem? Using a poor-quality or underpowered supply can cause instability and hardware issues. How might it present itself? Random reboots SD card corruption Warning icons on the desktop Slow performance How to resolve it: Use a high-quality, official power supply and check for voltage issues. How often? Check if you see instability or after adding new peripherals. Step-by-step instructions: Use the official Raspberry Pi power supply If you see a lightning bolt icon, check your power source Run vcgencmd get_throttled to check for voltage problems 7. Cooling What’s the problem? The Pi can overheat, especially in warm environments or under heavy load. How might it present itself? Throttled performance High temperature warnings System shutdowns How to resolve it: Add cooling solutions like heatsinks, fans, or better airflow. How often? Check temperatures during heavy use or in hot weather. Step-by-step instructions: Monitor temperature: vcgencmd measure_temp If above 70°C, consider adding heatsinks or a fan Ensure your case has good ventilation 8. Use surge protection What’s the problem? Power surges or outages can damage your Pi or corrupt data. How might it present itself? Pi won’t boot after a storm Corrupted SD card Hardware failure How to resolve it: Use a surge protector or UPS (uninterruptible power supply). How often? Always keep your Pi plugged into surge protection. Step-by-step instructions: Plug your Pi’s power supply into a surge protector For extra safety, use a UPS for battery backup 9. Change default passwords What’s the problem? Leaving the default password makes your Pi vulnerable to attacks. How might it present itself? Unauthorized access Changed settings or files Compromised system How to resolve it: Change the default password and consider using SSH keys. How often? Immediately after setup, and whenever you suspect a breach. Step-by-step instructions: Open a terminal Run: passwd and follow the prompts For SSH, set up key-based authentication for extra security 10. Document your setup What’s the problem? Forgetting what you’ve changed or installed makes troubleshooting and upgrades difficult. How might it present itself? Can’t remember how you set something up Hard to fix issues or replicate setups How to resolve it: Keep notes or use version control to track changes. How often? Update your documentation whenever you make changes. Step-by-step instructions: Create a Markdown or text file for notes Record installed packages: dpkg --get-selections > packages.txt Save configuration files and changes Optionally, use Git to version control your notes and configs 11. Bonus Ansible script What’s the problem? Setting up multiple Pis or repeating setups is time-consuming and error-prone. How might it present itself? Inconsistent configurations Wasted time on manual setup How to resolve it: Automate your setup with Ansible playbooks. How often? Whenever you set up a new Pi or make major changes. Step-by-step instructions: Install Ansible on your main computer: sudo apt install ansible Write a playbook to install packages and configure your Pi Run the playbook: ansible-playbook -i <pi_ip>, playbook.yml Update your playbook as your setup evolves Liked this article? You might like these too. How to Install Pi-Apps on a Raspberry Pi Learn how to install the Pi-Apps on your Raspberry Pi to easily discover and install new applications. Pikon II, The Ultimate DIY Raspberry Pi Camera! The PiKon II is a DIY Raspberry Pi camera project that allows you to build your own camera system. This guide provides step-by-step instructions to create a high-quality camera using the Raspberry Pi and Python. Raspberry Pi Home Hub Build a Raspberry Pi Home Hub with a 7" touchscreen display and Kivy Guiding Light Hey Robot Makers! Sync Files on your Pis, with Syncthing NextCloud You can host your own NextCloud server on your Raspberry Pi, and share files online with your friends and family.
How to Keep your Raspberry Pi happy Tips and tricks to maintain your Raspberry Pi for optimal performance and longevity. 30 August 2025 8 minute read By Share this article on Table of Contents 10 Raspberry Pi Tips for a Happier Pi1. Removing large files2. Keeping your system updated3. Backing upUsing Crontab4. Monitoring system performance with htop5. Cleaning up the file systemJournalctl6. Power Supply7. Cooling8. Use surge protection9. Change default passwords10. Document your setup11. Bonus Ansible script Tags: raspberry pi software Difficulty: beginner Category: raspberrypi software productivity
10 Raspberry Pi Tips for a Happier Pi Removing large files Keeping your system updated Backing up Monitoring system performance with htop Cleaning up the file system - force the maintenance scripts to run immediately, and a bit of background about what the maintenance scripts are, how often they run, what they do and what they leave behind Power Supply - use a good quality power supply to avoid issues Cooling - consider using heatsinks or fans to keep your Raspberry Pi cool, especially under heavy load Use surge protection – Plug your Pi into a surge protector to protect it from power spikes and outages. Change default passwords – Always change the default password for your Pi to keep it secure from unauthorized access. Document your setup – Keep notes on your configurations, installed software, and any changes you make. This helps with troubleshooting and future upgrades. Bonus Ansible script – Automate your Raspberry Pi setup and configuration with Ansible for easier management and deployment. 1. Removing large files What’s the problem? Over time, your Raspberry Pi can fill up with large or unnecessary files, which can slow down your system or even cause it to stop working if the SD card is full. How might it present itself? “No space left on device” errors Slow performance Inability to save files or install updates How to resolve it: Find and remove large files you no longer need. How often? Check every 1–2 months, or if you notice storage issues. Step-by-step instructions: Install ncdu: sudo apt install ncdu Run ncdu in your home directory: ncdu ~ Use arrow keys to browse and identify large files/folders Press d to delete unwanted files Empty the trash if you use a desktop environment 2. Keeping your system updated What’s the problem? Outdated software can have security vulnerabilities and bugs. Hackers may use known vulnerabilities to exploit your system, hack it and potentially hijack your computer - the so called ransomware attack. How might it present itself? Security warnings Software crashes Incompatibility with new software How to resolve it: Regularly update your system packages. How often? At least once a month, or when prompted. Step-by-step instructions: Open a terminal Run: sudo apt update Then: sudo apt upgrade -y Reboot if the system asks you to 3. Backing up What’s the problem? SD cards can fail, and accidental deletions or corruption can cause data loss. How might it present itself? Pi won’t boot Missing files Lost configurations How to resolve it: Regularly back up your SD card or important files to another device or cloud storage. How often? Monthly, or before making major changes. Step-by-step instructions: To back up the whole SD card, shut down the Pi and remove the card. Use a card reader on your PC/Mac. Use Raspberry Pi Imager or dd to create an image of the card. For file backups, use rsync or copy important folders to another drive or cloud. Backing up configuration files: To backup the configuration files, you can use the following command: sudo tar -czvf backup.tar.gz /etc Scheduling a backup with crontab To schedule regular backups, you can use cron. Here’s how to set it up: Open the crontab editor: crontab -e Add a line to schedule the backup (e.g., daily at 2 AM): 0 2 * * * sudo tar -czvf /path/to/backup/backup_$(date +\%F).tar.gz /etc Save and exit the editor. Using Crontab Crontab is a time-based job scheduler in Unix-like operating systems. You can use it to schedule tasks to run at specific intervals. For example, you can use crontab to schedule backups, system updates, or any other repetitive task. Crontab format: * * * * * command_to_execute The five asterisks represent different time and date fields: Minute (0-59) Hour (0-23) Day of the month (1-31) Month (1-12) Day of the week (0-7) (Sunday is both 0 and 7) Crontab runs using the system’s cron daemon, which checks the crontab files and executes the scheduled tasks at the specified times. The user account under which the cron job runs may affect its permissions and environment. 4. Monitoring system performance with htop What’s the problem? Resource-heavy processes can slow down your Pi or cause it to freeze. How might it present itself? Slow response High CPU temperature Unresponsive programs How to resolve it: Monitor system resources and identify problematic processes. How often? Check when you notice slowness or monthly as a checkup. Step-by-step instructions: Install htop: sudo apt install htop Run: htop Look for processes using high CPU or memory Use F9 to kill a process if needed 5. Cleaning up the file system What’s the problem? Temporary files and file system fragmentation can waste space and slow down your Pi. How might it present itself? Disk space shrinking over time Slower file access How to resolve it: Run file system maintenance scripts to clean up and optimize storage. How often? Every 1–2 months, or if you notice storage issues. Step-by-step instructions: To trim unused blocks (on SSDs/SD cards): sudo fstrim -av To clear apt cache: sudo apt clean To remove old logs: sudo journalctl --vacuum-time=2weeks To run all maintenance scripts: sudo systemctl start fstrim.timer Journalctl Journalctl is a command-line tool for querying and displaying messages from the journal, managed by systemd. It provides a way to view logs from the systemd journal, which includes logs from the kernel, system services, and user applications. The vacuum command is used to remove old journal logs and free up disk space. It normally runs automatically, every time the system boots. 6. Power Supply What’s the problem? Using a poor-quality or underpowered supply can cause instability and hardware issues. How might it present itself? Random reboots SD card corruption Warning icons on the desktop Slow performance How to resolve it: Use a high-quality, official power supply and check for voltage issues. How often? Check if you see instability or after adding new peripherals. Step-by-step instructions: Use the official Raspberry Pi power supply If you see a lightning bolt icon, check your power source Run vcgencmd get_throttled to check for voltage problems 7. Cooling What’s the problem? The Pi can overheat, especially in warm environments or under heavy load. How might it present itself? Throttled performance High temperature warnings System shutdowns How to resolve it: Add cooling solutions like heatsinks, fans, or better airflow. How often? Check temperatures during heavy use or in hot weather. Step-by-step instructions: Monitor temperature: vcgencmd measure_temp If above 70°C, consider adding heatsinks or a fan Ensure your case has good ventilation 8. Use surge protection What’s the problem? Power surges or outages can damage your Pi or corrupt data. How might it present itself? Pi won’t boot after a storm Corrupted SD card Hardware failure How to resolve it: Use a surge protector or UPS (uninterruptible power supply). How often? Always keep your Pi plugged into surge protection. Step-by-step instructions: Plug your Pi’s power supply into a surge protector For extra safety, use a UPS for battery backup 9. Change default passwords What’s the problem? Leaving the default password makes your Pi vulnerable to attacks. How might it present itself? Unauthorized access Changed settings or files Compromised system How to resolve it: Change the default password and consider using SSH keys. How often? Immediately after setup, and whenever you suspect a breach. Step-by-step instructions: Open a terminal Run: passwd and follow the prompts For SSH, set up key-based authentication for extra security 10. Document your setup What’s the problem? Forgetting what you’ve changed or installed makes troubleshooting and upgrades difficult. How might it present itself? Can’t remember how you set something up Hard to fix issues or replicate setups How to resolve it: Keep notes or use version control to track changes. How often? Update your documentation whenever you make changes. Step-by-step instructions: Create a Markdown or text file for notes Record installed packages: dpkg --get-selections > packages.txt Save configuration files and changes Optionally, use Git to version control your notes and configs 11. Bonus Ansible script What’s the problem? Setting up multiple Pis or repeating setups is time-consuming and error-prone. How might it present itself? Inconsistent configurations Wasted time on manual setup How to resolve it: Automate your setup with Ansible playbooks. How often? Whenever you set up a new Pi or make major changes. Step-by-step instructions: Install Ansible on your main computer: sudo apt install ansible Write a playbook to install packages and configure your Pi Run the playbook: ansible-playbook -i <pi_ip>, playbook.yml Update your playbook as your setup evolves