You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Production-ready ZRAM optimization for Raspberry Pi devices
Reduce SD card wear, improve performance, and optimize memory usage with compressed swap in RAM
Install and configure ZRAM with a single command โ no complex configuration needed
๐พ SD Card Protection
Eliminates swap-on-microSD to prevent premature wear and extend device lifespan
๐ Performance Boost
Compressed swap in RAM reduces I/O wait and improves system responsiveness
๐ฏ Raspberry Pi Optimized
Specifically tuned for Pi devices with 512MB+ RAM (3B+, 4, 5, Zero 2 W)
๐ Production Ready
Idempotent scripts with clean error handling โ safe to run multiple times
โก Systemd Integration
Automatic startup and management via systemd services
๐งฉ Minimal Dependencies
Uses only core Linux utilities โ no extra packages required
๐ฏ What is ZRAM?
ZRAM (formerly compcache) is a Linux kernel feature that creates a compressed block device in RAM. Instead of writing swap data to your SD card (which causes wear and is slow), ZRAM keeps everything in compressed memory.
๐ก Why Use ZRAM?
Problem
Solution
SD Card Wear
Swap writes to SD cards reduce their lifespan. ZRAM eliminates this.
Slow Swap
SD card swap is ~100x slower than RAM. ZRAM compression is ~10x faster.
Memory Pressure
When RAM runs low, the system slows down. ZRAM provides extra virtual memory.
System Stability
Under heavy load, systems without swap can crash. ZRAM prevents this.
๐ Root Access Required: ZRAM setup requires privileged access for system configuration
๐ก๏ธ No Backing Files: Avoid using microSD for ZRAM backing (default disabled)
๐ Logging: All operations are logged for audit purposes
๐ System Integration: Service runs at boot with appropriate permissions
๐ค Contributing
We welcome contributions! Here's how you can help:
๐ Report Bugs: Open an issue with detailed reproduction steps
๐ก Suggest Features: Share your ideas for improvements
๐ Improve Documentation: Help make our docs clearer
๐ง Submit Code: Fix bugs or add new features
๐งช Test: Try on different hardware and report results
๐ Development Setup
# Clone the repository
git clone https://github.com/4riful/raspberrypi-zram-optimizer.git
cd raspberrypi-zram-optimizer
# Create a new branch
git checkout -b feature/your-feature
# Make changes and test# ...# Commit and push
git commit -m "feat: add your feature"
git push origin feature/your-feature
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
MIT License
Copyright (c) 2026 4riful
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...
๐ Acknowledgments
๐ง Linux Kernel Team: For ZRAM implementation
๐ Raspberry Pi Foundation: For the amazing hardware platform
๐ Open Source Community: For inspiration and feedback
๐ฅ Contributors: Thanks to all contributors who helped improve this project