Files
metaverseDubai/docs/setup/UE5_DISK_SPACE_OPTIMIZATION.md
2026-07-07 03:43:19 -07:00

216 lines
5.0 KiB
Markdown

# Unreal Engine 5.4.1 Disk Space Optimization Guide
## Overview
This guide explains how the installation script reduces disk space requirements from ~100GB+ to approximately **~300GB** (1/3 of 926GB available).
## Optimization Strategies
### 1. Shallow Git Clone
- **Method**: Using `--depth=1` flag
- **Savings**: Reduces repository size from ~15GB to ~10GB
- **Trade-off**: Cannot access full git history (not needed for building)
### 2. Build Only Development Editor
- **Method**: Building only `UnrealEditor` target (Development configuration)
- **Savings**: ~50-70GB (skips Shipping builds, all platform builds, templates)
- **Command**: `make -j4 UnrealEditor`
- **Trade-off**: Cannot package Shipping builds without rebuilding
### 3. Limited CPU Cores
- **Method**: Using 4 cores instead of all available cores
- **Benefit**: Reduces memory usage, prevents system overload
- **Build Time**: 4-6+ hours (vs 2-4 hours with all cores)
- **Command**: `make -j4 UnrealEditor`
### 4. Cleanup Intermediate Files
- **Method**: Removing `.o`, `.obj`, `.d`, `.pch` files after build
- **Savings**: ~20-30GB
- **Location**: `Engine/Intermediate/`
### 5. Skip Optional Components
- **Not Built**:
- Shipping builds
- All platform builds (only Linux)
- Project templates
- Sample projects
- Documentation builds
- Additional tools (only Editor)
## Disk Space Breakdown
### Typical Installation Sizes
| Component | Full Build | Optimized Build |
|-----------|------------|-----------------|
| Source code | ~10GB | ~10GB |
| Dependencies | ~20GB | ~20GB |
| Development Editor | ~40GB | ~40GB |
| Shipping builds | ~30GB | **0GB** (skipped) |
| Templates/Samples | ~15GB | **0GB** (skipped) |
| Intermediate files | ~30GB | ~10GB (cleaned) |
| **Total** | **~145GB** | **~80GB** |
### Additional Space Considerations
- **Project files**: ~5-10GB per project
- **Cooked content**: ~10-20GB per project
- **Derived data cache**: ~5-10GB
- **Total with project**: ~100-110GB
## Configuration Options
### Change CPU Cores
Edit `scripts/install_ue5_5.4.1.sh`:
```bash
# Find this line (around line 170):
NUM_CORES=4
# Change to desired number:
NUM_CORES=8 # Use 8 cores
NUM_CORES=2 # Use 2 cores (slower but less memory)
```
### Build Additional Targets
If you need Shipping builds later:
```bash
cd ~/UnrealEngine
make -j4 UnrealEditor-Linux-Shipping
```
### Build Templates (Optional)
If you need project templates:
```bash
cd ~/UnrealEngine
make -j4 UnrealEditor UnrealGame
```
## Further Disk Space Reduction
### 1. Remove Source After Build (Advanced)
**Warning**: This prevents rebuilding from source. Only do this if you're certain you won't need to rebuild.
```bash
# After successful build, remove source files
cd ~/UnrealEngine
rm -rf Engine/Source/Editor
rm -rf Engine/Source/Developer
# Keep Engine/Source/Runtime for runtime features
```
**Savings**: ~5-10GB
**Risk**: Cannot rebuild without re-cloning
### 2. Use Symbolic Links for Projects
Store projects on a different drive and use symbolic links:
```bash
# Create project on larger drive
mkdir /mnt/d/Projects/DubaiMetaverse
ln -s /mnt/d/Projects/DubaiMetaverse ~/Projects/DubaiMetaverse
```
### 3. Clean Derived Data Cache Periodically
```bash
# Remove Unreal Engine derived data cache
rm -rf ~/.config/Epic/UnrealEngine/5.4/DerivedDataCache
```
**Savings**: ~5-10GB
**Trade-off**: Assets will need to be recompiled on next launch
### 4. Compress Installation Directory
```bash
# Create compressed archive (optional, for backup)
cd ~
tar -czf UnrealEngine-5.4.1-backup.tar.gz UnrealEngine/
```
## Monitoring Disk Usage
### Check Installation Size
```bash
du -sh ~/UnrealEngine
```
### Check Disk Space
```bash
df -h ~
```
### Find Large Files
```bash
cd ~/UnrealEngine
find . -type f -size +100M -exec ls -lh {} \; | sort -k5 -hr | head -20
```
## Recommended Settings
### For Development (Current Setup)
- **CPU Cores**: 4
- **Build Target**: Development Editor only
- **Disk Space**: ~80-100GB
- **Build Time**: 4-6 hours
### For Full Build (If Space Available)
- **CPU Cores**: 8-16
- **Build Target**: Development + Shipping
- **Disk Space**: ~150GB+
- **Build Time**: 2-4 hours
## Troubleshooting
### Out of Disk Space During Build
1. **Clean intermediate files**:
```bash
cd ~/UnrealEngine
find Engine/Intermediate -type f -name "*.o" -delete
```
2. **Reduce parallel jobs**:
```bash
# Edit script: change NUM_CORES=4 to NUM_CORES=2
```
3. **Build incrementally**:
```bash
# Build one module at a time (slower but uses less space)
make -j1 UnrealEditor
```
### Build Fails Due to Memory
- Reduce CPU cores: `NUM_CORES=2`
- Close other applications
- Add swap space if needed
## Summary
The optimized installation uses:
-**~80-100GB** disk space (vs ~150GB+ full build)
-**4 CPU cores** (configurable)
-**Development Editor only** (sufficient for development)
-**Automatic cleanup** of intermediate files
This provides approximately **1/3 of 926GB** usage while maintaining full development capabilities.
---
**Version**: 1.0
**Last Updated**: 2024