https://github.com/codeswhite/ramfill
Fills your RAM with dd
https://github.com/codeswhite/ramfill
Last synced: 3 months ago
JSON representation
Fills your RAM with dd
- Host: GitHub
- URL: https://github.com/codeswhite/ramfill
- Owner: codeswhite
- License: mit
- Created: 2025-04-18T09:36:22.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-17T23:24:35.000Z (4 months ago)
- Last Synced: 2025-09-18T01:16:51.825Z (4 months ago)
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Ramfill
A simple Linux RAM filler utility for testing memory pressure using tmpfs.
## Purpose
This script allows you to simulate RAM pressure by filling a temporary filesystem (`tmpfs`) with zeroed or random data. Useful for:
- Stress testing systems under memory load
- Observing behavior under RAM exhaustion
- Simulating production environments with limited free memory
## Features
- Uses `tmpfs` under `/tmp/ramfill` for safety (RAM-only, not disk)
- Reads config from `~/.config/ramfill.conf`
- Fill using `/dev/zero` (default) or `/dev/urandom`
- CLI with `start`, `stop`, and `restart`
- Reports memory usage and what will be freed on stop
## Installation
1. Copy `ramfill.sh` to a directory in your `$PATH`, e.g., `~/bin`
2. Make it executable:
```bash
chmod +x ~/bin/ramfill.sh
```
3. Create a config file at `~/.config/ramfill.conf`:
```bash
# ~/.config/ramfill.conf
RAM_FILL_SIZE="2G"
FILL_SOURCE="zero" # or "urandom"
```
## Usage
```bash
ramfill.sh start # Mounts tmpfs and fills it
ramfill.sh stop # Unmounts tmpfs and frees memory
ramfill.sh restart # Stops and then starts again
```
## Notes
- Requires `sudo` for mounting tmpfs
- Only uses RAM, no risk to disk
- Don't use `urandom` unless you specifically need entropy-based fill
## License
MIT