Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 05c916e9a9 |
@@ -125,7 +125,21 @@ func (c *Client) RestoreSnapshot(snapshot *SnapshotMetadata, targetDataset strin
|
|||||||
fmt.Printf("Target: %s\n", targetDataset)
|
fmt.Printf("Target: %s\n", targetDataset)
|
||||||
fmt.Printf("Size: %.2f GB\n", float64(snapshot.SizeBytes)/(1024*1024*1024))
|
fmt.Printf("Size: %.2f GB\n", float64(snapshot.SizeBytes)/(1024*1024*1024))
|
||||||
fmt.Printf("Storage: %s\n", snapshot.StorageType)
|
fmt.Printf("Storage: %s\n", snapshot.StorageType)
|
||||||
fmt.Printf("Compressed: %v\n\n", snapshot.Compressed)
|
fmt.Printf("Compressed: %v\n", snapshot.Compressed)
|
||||||
|
fmt.Printf("Incremental: %v\n\n", snapshot.Incremental)
|
||||||
|
|
||||||
|
// For incremental snapshots, we need special handling
|
||||||
|
if snapshot.Incremental && force {
|
||||||
|
// Check if target dataset exists
|
||||||
|
if _, err := zfs.GetDataset(targetDataset); err == nil {
|
||||||
|
fmt.Printf("→ Destroying existing dataset for incremental restore...\n")
|
||||||
|
// Destroy the existing dataset to allow clean restore
|
||||||
|
cmd := exec.Command("zfs", "destroy", "-r", targetDataset)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
fmt.Printf(" Warning: could not destroy dataset (may not exist): %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if target dataset exists
|
// Check if target dataset exists
|
||||||
if !force {
|
if !force {
|
||||||
|
|||||||
Reference in New Issue
Block a user