feat: format empty partitions on system disk (v0.32.6)
Detect and offer to format empty (no filesystem) partitions on the system disk. Adds IsSystemPartition() for granular per-partition safety checks instead of blocking the entire system disk. Init wizard shows formatable partitions with appropriate warnings. Add felhotest demo node to docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,12 +61,25 @@ func FormatAndMount(req FormatRequest, progress chan<- FormatProgress) (string,
|
||||
return "", fail("validating", "Az eszköz nem létezik: "+req.DevicePath, err)
|
||||
}
|
||||
|
||||
isSystem, err := IsSystemDisk(req.DevicePath)
|
||||
if err != nil {
|
||||
return "", fail("validating", "Rendszermeghajtó ellenőrzése sikertelen", err)
|
||||
}
|
||||
if isSystem {
|
||||
return "", fail("validating", "Ez a rendszermeghajtó — nem formázható!", fmt.Errorf("device is system disk"))
|
||||
if req.CreatePartition {
|
||||
// Whole-disk operation: block if any partition on this disk is a system partition.
|
||||
isSystem, err := IsSystemDisk(req.DevicePath)
|
||||
if err != nil {
|
||||
return "", fail("validating", "Rendszermeghajtó ellenőrzése sikertelen", err)
|
||||
}
|
||||
if isSystem {
|
||||
return "", fail("validating", "Ez a rendszermeghajtó — nem formázható!", fmt.Errorf("device is system disk"))
|
||||
}
|
||||
} else {
|
||||
// Partition-only operation: block only if THIS specific partition is a system partition.
|
||||
// Allows formatting empty partitions on the system disk (e.g., dedicated data partition).
|
||||
isSysPart, err := IsSystemPartition(req.DevicePath)
|
||||
if err != nil {
|
||||
return "", fail("validating", "Rendszerpartíció ellenőrzése sikertelen", err)
|
||||
}
|
||||
if isSysPart {
|
||||
return "", fail("validating", "Ez rendszerpartíció — nem formázható!", fmt.Errorf("partition is a system partition"))
|
||||
}
|
||||
}
|
||||
|
||||
mounted, err := IsDeviceMounted(req.DevicePath)
|
||||
|
||||
Reference in New Issue
Block a user