60 lines
1.7 KiB
Markdown
60 lines
1.7 KiB
Markdown
# ZFS Pool Mountpoint Fix
|
|
|
|
## Issue
|
|
ZFS pool creation was failing with error:
|
|
```
|
|
cannot mount '/default': failed to create mountpoint: Read-only file system
|
|
```
|
|
|
|
The issue was that ZFS was trying to mount pools to the root filesystem (`/default`), which is read-only.
|
|
|
|
## Solution
|
|
Updated the ZFS pool creation code to set a default mountpoint to `/opt/calypso/data/pool/<pool-name>` for all pools.
|
|
|
|
## Changes Made
|
|
|
|
### 1. Updated `backend/internal/storage/zfs.go`
|
|
- Added mountpoint configuration during pool creation using `-m` flag
|
|
- Set default mountpoint to `/opt/calypso/data/pool/<pool-name>`
|
|
- Added code to create the mountpoint directory before pool creation
|
|
- Added logging for mountpoint creation
|
|
|
|
**Key Changes:**
|
|
```go
|
|
// Set default mountpoint to /opt/calypso/data/pool/<pool-name>
|
|
mountPoint := fmt.Sprintf("/opt/calypso/data/pool/%s", name)
|
|
args = append(args, "-m", mountPoint)
|
|
|
|
// Create mountpoint directory if it doesn't exist
|
|
if err := os.MkdirAll(mountPoint, 0755); err != nil {
|
|
return nil, fmt.Errorf("failed to create mountpoint directory %s: %w", mountPoint, err)
|
|
}
|
|
```
|
|
|
|
### 2. Directory Setup
|
|
- Created `/opt/calypso/data/pool` directory
|
|
- Set ownership to `calypso:calypso`
|
|
- Set permissions to `0755`
|
|
|
|
## Default Mountpoint Structure
|
|
All ZFS pools will now be mounted under:
|
|
```
|
|
/opt/calypso/data/pool/
|
|
├── pool-name-1/
|
|
├── pool-name-2/
|
|
└── ...
|
|
```
|
|
|
|
## Testing
|
|
1. Backend rebuilt successfully
|
|
2. Service restarted successfully
|
|
3. Ready to test pool creation from frontend
|
|
|
|
## Next Steps
|
|
- Test pool creation from the frontend UI
|
|
- Verify that pools are mounted correctly at `/opt/calypso/data/pool/<pool-name>`
|
|
- Ensure proper permissions for pool mountpoints
|
|
|
|
## Date
|
|
2026-01-09
|