Skip to content

Commit

Permalink
fix: fast wipe also last 1MB of the device
Browse files Browse the repository at this point in the history
This fully erases GPT partition table.

Backported from v2 branch, for Sidero Metal.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Sep 11, 2024
1 parent d9313ea commit c671e79
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion blockdevice/blockdevice_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,19 @@ func (bd *BlockDevice) FastWipe() error {
}

_, err = bd.WipeRange(0, wipeLength)
if err != nil {
return err
}

return err
// wipe the last FastWipeRange bytes of the device as well
if size >= FastWipeRange*2 {
_, err = bd.WipeRange(size-FastWipeRange, FastWipeRange)
if err != nil {
return err
}
}

return nil
}

// WipeRange the blockdevice [start, start+length).
Expand Down

0 comments on commit c671e79

Please sign in to comment.