feat: Add --workdir flag for cluster restore

Solves disk space issues on VMs with small system disks but large NFS mounts.

Use case:
- VM has small / partition (e.g., 7.8G with 2.3G used)
- Backup archive on NFS mount (e.g., /u01/dba with 140G free)
- Restore fails: "insufficient disk space: 74.7% used - need at least 4x archive size"

Solution:
- Added --workdir flag to restore cluster command
- Allows specifying alternative extraction directory
- Interactive confirmation required for safety
- Updated error messages with helpful tip

Example:
  dbbackup restore cluster backup.tar.gz --workdir /u01/dba/restore_tmp --confirm

This is environmental, not a bug. Code working brilliantly! 👨‍🍳💋
This commit is contained in:
2025-11-28 11:24:19 +00:00
parent 57ba8c7c1e
commit e581f0a357
3 changed files with 70 additions and 7 deletions

View File

@@ -201,6 +201,15 @@ Restore full cluster:
./dbbackup restore cluster cluster_backup.tar.gz --confirm
```
**For VMs with limited system disk space** (common with NFS-mounted backup storage):
```bash
# Use NFS mount or larger partition for extraction
./dbbackup restore cluster cluster_backup.tar.gz --workdir /u01/dba/restore_tmp --confirm
```
This prevents "insufficient disk space" errors when the backup directory has space but the system root partition is small.
## Commands
### Global Flags (Available for all commands)
@@ -1257,7 +1266,7 @@ Enable detailed logging:
- **"Ident authentication failed"** - Run as matching OS user or configure password authentication
- **"Permission denied"** - Check database user privileges
- **"Disk space check failed"** - Ensure 4x archive size available
- **"Disk space check failed"** - Ensure 4x archive size available. For VMs with small system disks, use `--workdir /path/to/larger/partition` to extract on NFS mount or larger disk
- **"Archive validation failed"** - Backup file corrupted or incomplete
## Building