Try resizing all found devices (#4099)

* Try resizing all found devices

fixes #4098

Signed-off-by: Chris Irrgang <chris.irrgang@gmx.de>

* Update package tags of pkg/extend

Signed-off-by: Chris Irrgang <chris.irrgang@gmx.de>

---------

Signed-off-by: Chris Irrgang <chris.irrgang@gmx.de>
This commit is contained in:
Chris Irrgang
2025-01-27 10:24:45 +01:00
committed by GitHub
parent fd6839d0fe
commit 66ca00915a
5 changed files with 15 additions and 7 deletions

View File

@@ -22,8 +22,9 @@ import (
const timeout = 60
var (
fsTypeVar string
driveKeys []string
fsTypeVar string
stopOnError bool
driveKeys []string
)
// Fdisk is the JSON output from libfdisk
@@ -57,7 +58,12 @@ func autoextend(fsType string) error {
continue
}
if err := extend(d, fsType); err != nil {
return err
if stopOnError {
return err
}
log.Printf("Could not extend partition on device %s. Skipping", d)
continue
}
}
return nil
@@ -312,11 +318,13 @@ func findDrives() {
func init() {
flag.StringVar(&fsTypeVar, "type", "ext4", "Type of filesystem to create")
flag.BoolVar(&stopOnError, "stop-on-error", true, "Stops extending the remaining devices on first error")
}
func main() {
flag.Parse()
findDrives()
if flag.NArg() == 0 {
if err := autoextend(fsTypeVar); err != nil {
log.Fatalf("%v", err)