Storage Overview
Gitaly uses named storage locations to organize Git repositories. Each storage has:- A unique name used to reference it
- A path pointing to the directory containing Git repositories
Basic Storage Configuration
Storages are defined in the Gitaly configuration file using[[storage]] sections:
Storage Parameters
Unique identifier for this storage. This name is used by GitLab to reference the storage.
Absolute path to the directory containing Git repositories. This directory must exist and be writable by the Gitaly user.
Configuring Multiple Storages
You can configure multiple storage locations by adding additional[[storage]] sections:
Configure GitLab
Update your GitLab configuration to recognize the new storages.For Omnibus installations, edit For source installations, edit
/etc/gitlab/gitlab.rb:config/gitlab.yml:Storage Requirements
File System Requirements
Supported file systems
Supported file systems
Gitaly supports standard POSIX-compliant file systems:
- ext4 (recommended)
- XFS
- NFS (with caveats - see below)
- FUSE-based file systems
- Network file systems other than NFS
Permissions
Permissions
The storage directory must be:
- Owned by the Gitaly user (typically
git) - Have write permissions for the owner
- Have read and execute permissions for the owner
Disk space
Disk space
Plan for adequate disk space:
- Git repositories can grow large over time
- Allow space for garbage collection temporary files
- Monitor disk usage regularly
NFS Considerations
If you must use NFS:- Use NFSv4 or later
- Enable file locking on the NFS server
- Use hard mounts (not soft mounts)
- Disable atime updates for performance:
- Monitor for stale file handles which can cause issues
Storage Best Practices
Use fast storage
Use SSD or NVMe drives for repository storage. Git operations are I/O intensive and benefit significantly from fast storage.
Monitor disk usage
Set up monitoring and alerting for disk space. Low disk space can cause repository corruption.
Regular maintenance
Configure daily maintenance to keep repositories optimized:
Backup regularly
Implement regular backups of all storage locations. Git repositories contain critical source code.
Storage Layout
Gitaly stores repositories using GitLab’s hashed storage format. The directory structure looks like:Hashed Storage Benefits
- Better distribution: Repositories are evenly distributed across directories
- Improved performance: Avoids issues with too many files in a single directory
- Easier backups: Directory structure doesn’t change when projects are renamed
- Scalability: Handles millions of repositories efficiently
GitLab automatically uses hashed storage for all new repositories. Legacy storage is deprecated.
Configuring Storage in GitLab
After configuring storage in Gitaly, you need to configure GitLab to use it:Omnibus GitLab
Edit/etc/gitlab/gitlab.rb:
Source Installation
Editconfig/gitlab.yml:
Verifying Storage Configuration
After configuring storage, verify it’s working:Verify in GitLab Admin
In GitLab, navigate to Admin Area > Overview > Gitaly Servers to see all configured storages and their health status.
Troubleshooting
Storage Not Found
If GitLab reports a storage doesn’t exist:- Verify the storage name matches exactly in both Gitaly and GitLab configs
- Ensure the directory exists and has correct permissions
- Check Gitaly logs for errors:
/var/log/gitlab/gitaly/ - Restart Gitaly and GitLab after configuration changes
Permission Denied Errors
If you see permission errors:Disk Space Issues
If disk space is low:- Run garbage collection on repositories to reclaim space
- Check for large objects:
git rev-list --objects --all | git cat-file --batch-check - Review repository forks: Forks consume storage
- Enable daily maintenance to keep repositories optimized
Migration Between Storages
GitLab provides tools to migrate repositories between storages:Related Configuration
Configuration Reference
View all Gitaly configuration options
Daily Maintenance
Configure automatic repository optimization