main #1
@@ -213,12 +213,20 @@ func (s *Service) CreatePool(name string, vdevs []string, options map[string]str
|
|||||||
log.Printf("warning: failed to pre-create mountpoint %s: %v (continuing anyway)", mountpoint, err)
|
log.Printf("warning: failed to pre-create mountpoint %s: %v (continuing anyway)", mountpoint, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle canmount as DATASET property not the vdev property
|
||||||
|
canmount := "noauto"
|
||||||
|
if v, ok := options["canmount"]; ok && v != "" {
|
||||||
|
canmount = v
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(options, "canmount")
|
||||||
|
|
||||||
// Set canmount=noauto to prevent automatic mounting during creation
|
// Set canmount=noauto to prevent automatic mounting during creation
|
||||||
// This allows pool creation to succeed even if mountpoint can't be created
|
// This allows pool creation to succeed even if mountpoint can't be created
|
||||||
if _, hasCanmount := options["canmount"]; !hasCanmount {
|
// if _, hasCanmount := options["canmount"]; !hasCanmount {
|
||||||
options["canmount"] = "noauto"
|
// options["canmount"] = "noauto"
|
||||||
}
|
// }
|
||||||
|
|
||||||
// IMPORTANT: Don't set mountpoint during pool creation
|
// IMPORTANT: Don't set mountpoint during pool creation
|
||||||
// ZFS tries to mount immediately during creation, which can fail
|
// ZFS tries to mount immediately during creation, which can fail
|
||||||
@@ -231,6 +239,8 @@ func (s *Service) CreatePool(name string, vdevs []string, options map[string]str
|
|||||||
args = append(args, "-o", fmt.Sprintf("%s=%s", k, v))
|
args = append(args, "-o", fmt.Sprintf("%s=%s", k, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args = append(args, "-O", fmt.Sprintf("canmount=%s", canmount))
|
||||||
|
|
||||||
args = append(args, name)
|
args = append(args, name)
|
||||||
|
|
||||||
// Normalize vdev paths - ensure they start with /dev/ if they don't already
|
// Normalize vdev paths - ensure they start with /dev/ if they don't already
|
||||||
|
|||||||
Reference in New Issue
Block a user