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

@ -23,6 +23,7 @@ const timeout = 60
var ( var (
fsTypeVar string fsTypeVar string
stopOnError bool
driveKeys []string driveKeys []string
) )
@ -57,8 +58,13 @@ func autoextend(fsType string) error {
continue continue
} }
if err := extend(d, fsType); err != nil { if err := extend(d, fsType); err != nil {
if stopOnError {
return err return err
} }
log.Printf("Could not extend partition on device %s. Skipping", d)
continue
}
} }
return nil return nil
} }
@ -312,11 +318,13 @@ func findDrives() {
func init() { func init() {
flag.StringVar(&fsTypeVar, "type", "ext4", "Type of filesystem to create") 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() { func main() {
flag.Parse() flag.Parse()
findDrives() findDrives()
if flag.NArg() == 0 { if flag.NArg() == 0 {
if err := autoextend(fsTypeVar); err != nil { if err := autoextend(fsTypeVar); err != nil {
log.Fatalf("%v", err) log.Fatalf("%v", err)

View File

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

View File

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

View File

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

View File

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