Storage
🗄️
Space for files.
Persistent local web space for code and files.
Booking
Web storage is a required component available in different plans. Each environment needs to have storage booked.
Configuration
The storage is integrated as a persistent file system. You have direct code access by SSH and SFTP. The storage contains the deployed code, as well as runtime data, such as uploads and temporary files. See the directory structure article to learn about pre-configured folders. The dashboard shows metrics about the storage size.
Scaling
When autoscaling is enabled, smaller and larger plans are automatically booked, based on usage. When autoscaling is disabled, the storage is capped at the chosen plan. Once the limit is reached, the environment can not write on the file system until space is cleaned.
Why storage grows
Web storage may grow over time as your website writes more files to the disk. Keep an eye on the metrics provided in the dashboard. Most usage might be desired, misconfiguration or misusage can also be the source of growing storage demand. This can happen actively, or passively when bots are visiting the website:
- Extensive log file creation
- Unnecessary, redundant backups
- Too many or too large assets uploaded by editors
- Extensive cache file creation
Cleaning up the web storage
Web storage can grow in unexpected and undesired ways. Instead of just scaling up, review whether all storage is required and clean up if necessary:
- Connect via SSH or SFTP
- Use the
ducommand to identify large files, see below - Review if all files are required
- Delete unnecessary files, see below
- Wait a few minutes for the fortrabbit system to detect the new usage
Once the issue is resolved, update your code and configuration to prevent excessive storage growth, such as implementing proper log rotation or cleaning up temporary files regularly.
Finding large files with du
Use the du (disk usage) command via SSH to locate what's consuming the most storage:
# List directories and files sorted by size in current directory
du -sh ./* | sort -h
# Show 10 biggest files and directories in all subdirectories
du -ah . | sort -rh | head -n 10
Note that the disk usage command will not show you the exact same value as shown with the dashboard. The dashboard looks at how full the file system volume is, individual file sizes are often larger than actual used disk space.
File size vs volume usage
ducounts file sizes and sums them together to give you the size of all files in a directory. This is an estimate of disk usage and can differ from actual disk usage for many reasons. Great for finding large files to delete.dfreports actual disk free space and is more accure for how files are stored on disk. On fortrabbit rundf -h .to see the real disk usage, or you can just look at the dashboard metrics to see the same value.
Common sources of excessive storage
- Large assets uploaded by editors
- Old log files that should be rotated or deleted
- Temporary files and caches that can be regenerated
- Backup files or database dumps that are no longer needed
- User uploads that have been abandoned or duplicated
- Generated versions of files from builds or assets that can be recreated
Backups
Web storage backups are available through the additional backup component.