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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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)

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:8b5af3365fc7d015db4e44113d93c7b1f8e2d2ab
onboot:
- name: extend
image: linuxkit/extend:cad2e81be336573d9786b168037042900cf0cf0f
image: linuxkit/extend:9fa90cc4ba8c261b8eb5adacda71feb2f60d75e3
- name: mount
image: linuxkit/mount:2a507ef30302693682f9f612289028df00c58ac5
command: ["/usr/bin/mountie", "/var/lib/docker"]

View File

@ -9,7 +9,7 @@ onboot:
image: linuxkit/modprobe:fad39ef443853ef02520052cdbf6acbeb4ec7799
command: ["modprobe", "btrfs"]
- name: extend
image: linuxkit/extend:cad2e81be336573d9786b168037042900cf0cf0f
image: linuxkit/extend:9fa90cc4ba8c261b8eb5adacda71feb2f60d75e3
command: ["/usr/bin/extend", "-type", "btrfs"]
- name: mount
image: linuxkit/mount:2a507ef30302693682f9f612289028df00c58ac5

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:8b5af3365fc7d015db4e44113d93c7b1f8e2d2ab
onboot:
- name: extend
image: linuxkit/extend:cad2e81be336573d9786b168037042900cf0cf0f
image: linuxkit/extend:9fa90cc4ba8c261b8eb5adacda71feb2f60d75e3
command: ["/usr/bin/extend", "-type", "xfs"]
- name: mount
image: linuxkit/mount:2a507ef30302693682f9f612289028df00c58ac5

View File

@ -6,7 +6,7 @@ init:
- linuxkit/runc:8b5af3365fc7d015db4e44113d93c7b1f8e2d2ab
onboot:
- name: extend
image: linuxkit/extend:cad2e81be336573d9786b168037042900cf0cf0f
image: linuxkit/extend:9fa90cc4ba8c261b8eb5adacda71feb2f60d75e3
- name: mount
image: linuxkit/mount:2a507ef30302693682f9f612289028df00c58ac5
command: ["/usr/bin/mountie", "/var/lib/docker"]