b4bda38fa1
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>
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package storage
|
|
|
|
// BlockDevice represents a detected physical disk.
|
|
type BlockDevice struct {
|
|
Name string // "sdb"
|
|
Path string // "/dev/sdb"
|
|
Size string // "931.5G"
|
|
SizeBytes int64 // raw bytes from lsblk
|
|
Model string // "WD Elements 25A2"
|
|
Type string // "disk"
|
|
Removable bool // true for USB
|
|
Partitions []Partition // child partitions
|
|
Mounted bool // any partition is mounted
|
|
}
|
|
|
|
// Partition represents a partition on a block device.
|
|
type Partition struct {
|
|
Name string // "sdb1"
|
|
Path string // "/dev/sdb1"
|
|
Size string // "931.5G"
|
|
SizeBytes int64
|
|
FSType string // "ext4", "" for no filesystem
|
|
Label string // filesystem label
|
|
UUID string
|
|
MountPoint string // "" if not mounted
|
|
}
|
|
|
|
// FormatablePartition is an empty partition on a system disk that can be formatted.
|
|
type FormatablePartition struct {
|
|
Partition
|
|
ParentDiskName string // "sda"
|
|
ParentDiskPath string // "/dev/sda"
|
|
ParentDiskModel string // "Samsung SSD 870"
|
|
ParentDiskSize string // "500 GB"
|
|
}
|
|
|
|
// ScanResult from disk detection.
|
|
type ScanResult struct {
|
|
AvailableDisks []BlockDevice // Unmounted, non-system disks
|
|
SystemDisks []BlockDevice // System/mounted disks (display only)
|
|
FormatablePartitions []FormatablePartition // Empty partitions on system disks, safe to format
|
|
}
|