# Pool Delete Mountpoint Cleanup ## Issue Ketika pool dihapus, mount point directory tidak dihapus dari sistem. Mount point directory tetap ada di `/opt/calypso/data/pool/` meskipun pool sudah di-destroy. ## Root Cause Fungsi `DeletePool` tidak melakukan cleanup untuk mount point directory setelah pool di-destroy. ## Solution Menambahkan kode untuk menghapus mount point directory setelah pool di-destroy. ## Changes Made ### Updated `backend/internal/storage/zfs.go` **File**: `backend/internal/storage/zfs.go` (line 518-562) Menambahkan cleanup untuk mount point directory setelah pool di-destroy: **Before:** ```go // Mark disks as unused for _, diskPath := range pool.Disks { // ... } // Delete from database _, err = s.db.ExecContext(ctx, "DELETE FROM zfs_pools WHERE id = $1", poolID) // ... ``` **After:** ```go // Remove mount point directory (default: /opt/calypso/data/pool/) mountPoint := fmt.Sprintf("/opt/calypso/data/pool/%s", pool.Name) if err := os.RemoveAll(mountPoint); err != nil { s.logger.Warn("Failed to remove mount point directory", "mountpoint", mountPoint, "error", err) // Don't fail pool deletion if mount point removal fails } else { s.logger.Info("Removed mount point directory", "mountpoint", mountPoint) } // Mark disks as unused for _, diskPath := range pool.Disks { // ... } // Delete from database _, err = s.db.ExecContext(ctx, "DELETE FROM zfs_pools WHERE id = $1", poolID) // ... ``` ## Mount Point Location Default mount point untuk semua pools adalah: ``` /opt/calypso/data/pool// ``` ## Behavior 1. Pool di-destroy dari ZFS system 2. Mount point directory dihapus dengan `os.RemoveAll()` 3. Disks ditandai sebagai unused di database 4. Pool dihapus dari database ## Error Handling - Jika mount point removal gagal, hanya log warning - Pool deletion tetap berhasil meskipun mount point removal gagal - Ini memastikan bahwa pool deletion tidak gagal hanya karena mount point cleanup ## Testing 1. Create pool dengan nama "test-pool" 2. Verify mount point directory dibuat: `/opt/calypso/data/pool/test-pool/` 3. Delete pool 4. Verify mount point directory dihapus: `ls /opt/calypso/data/pool/test-pool` should fail ## Status ✅ **FIXED** - Mount point directory sekarang dihapus saat pool di-delete ## Date 2026-01-09