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:
# Show total size for current folder du -shshell
Note that disk usage will not show you the exact value as shown with the dashboard.
du - counts file sizes and sums them together to give you the size of all files in a directory. This can take a long time as it has to read every files metadata on disk. This is an estimate of disk usage, not exact and can differ from actual disk usage for many reasons.
df - reports actual disk free space, this is fast as it is read directly from the filesystem, and gives an accurate indication of how much more space a disk actually has free. Use df -h and look for the long cryptic name to see the same data as shown with the dashboard.
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.