fix: fast wipe also last 1MB of the device

This fully erases GPT partition table.

Backported from v2 branch, for Sidero Metal.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
diff --git a/.conform.yaml b/.conform.yaml
index ba8797d..0aa6575 100644
--- a/.conform.yaml
+++ b/.conform.yaml
@@ -1,37 +1,48 @@
 # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
 #
-# Generated on 2022-03-28T13:15:04Z by kres 8bc4139-dirty.
+# Generated on 2024-09-11T14:39:44Z by kres 8be5fa7.
 
----
 policies:
-- type: commit
-  spec:
-    dco: true
-    gpg:
-      required: true
-      identity:
-        gitHubOrganization: siderolabs
-    spellcheck:
-      locale: US
-    maximumOfOneCommit: true
-    header:
-      length: 89
-      imperative: true
-      case: lower
-      invalidLastCharacters: .
-    body:
-      required: true
-    conventional:
-      types: ["chore","docs","perf","refactor","style","test","release"]
-      scopes: [".*"]
-- type: license
-  spec:
-    skipPaths:
-      - .git/
-      - testdata/
-    includeSuffixes:
-      - .go
-    excludeSuffixes:
-      - .pb.go
-      - .pb.gw.go
-    header: "// This Source Code Form is subject to the terms of the Mozilla Public\u000A// License, v. 2.0. If a copy of the MPL was not distributed with this\u000A// file, You can obtain one at http://mozilla.org/MPL/2.0/.\u000A"
+  - type: commit
+    spec:
+      dco: true
+      gpg:
+        required: true
+        identity:
+          gitHubOrganization: siderolabs
+      spellcheck:
+        locale: US
+      maximumOfOneCommit: true
+      header:
+        length: 89
+        imperative: true
+        case: lower
+        invalidLastCharacters: .
+      body:
+        required: true
+      conventional:
+        types:
+          - chore
+          - docs
+          - perf
+          - refactor
+          - style
+          - test
+          - release
+        scopes:
+          - .*
+  - type: license
+    spec:
+      root: .
+      skipPaths:
+        - .git/
+        - testdata/
+      includeSuffixes:
+        - .go
+      excludeSuffixes:
+        - .pb.go
+        - .pb.gw.go
+      header: |
+        // This Source Code Form is subject to the terms of the Mozilla Public
+        // License, v. 2.0. If a copy of the MPL was not distributed with this
+        // file, You can obtain one at http://mozilla.org/MPL/2.0/.
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index a8b5ae1..1fba9a1 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,6 +1,6 @@
 # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
 #
-# Generated on 2023-11-23T12:47:00Z by kres 0759c81-dirty.
+# Generated on 2024-09-11T14:39:44Z by kres 8be5fa7.
 
 name: default
 concurrency:
@@ -29,26 +29,44 @@
       - self-hosted
       - generic
     if: (!startsWith(github.head_ref, 'renovate/') && !startsWith(github.head_ref, 'dependabot/'))
-    services:
-      buildkitd:
-        image: moby/buildkit:v0.12.3
-        options: --privileged
-        ports:
-          - 1234:1234
-        volumes:
-          - /var/lib/buildkit/${{ github.repository }}:/var/lib/buildkit
-          - /usr/etc/buildkit/buildkitd.toml:/etc/buildkit/buildkitd.toml
     steps:
+      - name: gather-system-info
+        id: system-info
+        uses: kenchan0130/actions-system-info@v1.3.0
+        continue-on-error: true
+      - name: print-system-info
+        run: |
+          MEMORY_GB=$((${{ steps.system-info.outputs.totalmem }}/1024/1024/1024))
+
+          OUTPUTS=(
+            "CPU Core: ${{ steps.system-info.outputs.cpu-core }}"
+            "CPU Model: ${{ steps.system-info.outputs.cpu-model }}"
+            "Hostname: ${{ steps.system-info.outputs.hostname }}"
+            "NodeName: ${NODE_NAME}"
+            "Kernel release: ${{ steps.system-info.outputs.kernel-release }}"
+            "Kernel version: ${{ steps.system-info.outputs.kernel-version }}"
+            "Name: ${{ steps.system-info.outputs.name }}"
+            "Platform: ${{ steps.system-info.outputs.platform }}"
+            "Release: ${{ steps.system-info.outputs.release }}"
+            "Total memory: ${MEMORY_GB} GB"
+          )
+
+          for OUTPUT in "${OUTPUTS[@]}";do
+            echo "${OUTPUT}"
+          done
+        continue-on-error: true
       - name: checkout
         uses: actions/checkout@v4
       - name: Unshallow
         run: |
           git fetch --prune --unshallow
       - name: Set up Docker Buildx
+        id: setup-buildx
         uses: docker/setup-buildx-action@v3
         with:
           driver: remote
-          endpoint: tcp://localhost:1234
+          endpoint: tcp://buildkit-amd64.ci.svc.cluster.local:1234
+        timeout-minutes: 10
       - name: base
         run: |
           make base
@@ -59,8 +77,11 @@
         run: |
           make unit-tests-race
       - name: coverage
-        run: |
-          make coverage
+        uses: codecov/codecov-action@v4
+        with:
+          files: _out/coverage-unit-tests.txt
+          token: ${{ secrets.CODECOV_TOKEN }}
+        timeout-minutes: 3
       - name: lint
         run: |
           make lint
diff --git a/.golangci.yml b/.golangci.yml
index 13a06ca..0c45fcd 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,21 +1,20 @@
 # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
 #
-# Generated on 2023-11-23T12:47:31Z by kres latest.
+# Generated on 2024-09-11T14:39:44Z by kres 8be5fa7.
 
 # options for analysis running
 run:
   timeout: 10m
   issues-exit-code: 1
   tests: true
-  build-tags: []
-  skip-dirs: []
-  skip-dirs-use-default: true
-  skip-files: []
+  build-tags: [ ]
   modules-download-mode: readonly
 
 # output configuration options
 output:
-  format: colored-line-number
+  formats:
+    - format: colored-line-number
+      path: stdout
   print-issued-lines: true
   print-linter-name: true
   uniq-by-line: true
@@ -32,56 +31,35 @@
     check-blank: true
   exhaustive:
     default-signifies-exhaustive: false
-  funlen:
-    lines: 60
-    statements: 40
   gci:
-    local-prefixes: github.com/siderolabs/go-blockdevice/
+    sections:
+      - standard # Standard section: captures all standard packages.
+      - default # Default section: contains all imports that could not be matched to another section type.
+      - localmodule # Imports from the same module.
   gocognit:
     min-complexity: 30
-  ireturn:
-    allow:
-      - anon
-      - error
-      - empty
-      - stdlib
-      - github.com\/talos-systems\/kres\/internal\/dag.Node
   nestif:
     min-complexity: 5
   goconst:
     min-len: 3
     min-occurrences: 3
   gocritic:
-    disabled-checks: []
+    disabled-checks: [ ]
   gocyclo:
     min-complexity: 20
   godot:
-    check-all: false
-  godox:
-    keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
-      - NOTE
-      - OPTIMIZE # marks code that should be optimized before merging
-      - HACK # marks hack-arounds that should be removed before merging
+    scope: declarations
   gofmt:
     simplify: true
-  goimports:
-    local-prefixes: github.com/siderolabs/go-blockdevice/
-  golint:
-    min-confidence: 0.8
-  gomnd:
-    settings: {}
-  gomodguard: {}
+  gomodguard: { }
   govet:
-    check-shadowing: true
     enable-all: true
-    disable:
-      - loopclosure
   lll:
     line-length: 200
     tab-width: 4
   misspell:
     locale: US
-    ignore-words: []
+    ignore-words: [ ]
   nakedret:
     max-func-lines: 30
   prealloc:
@@ -90,16 +68,15 @@
     for-loops: false # Report preallocation suggestions on for loops, false by default
   nolintlint:
     allow-unused: false
-    allow-leading-space: false
-    allow-no-explanation: []
+    allow-no-explanation: [ ]
     require-explanation: false
     require-specific: true
-  rowserrcheck: {}
-  testpackage: {}
+  rowserrcheck: { }
+  testpackage: { }
   unparam:
     check-exported: false
   unused:
-    check-exported: false
+    local-variables-are-used: false
   whitespace:
     multi-if: false   # Enforces newlines (or comments) after every multi-line if statement
     multi-func: false # Enforces newlines (or comments) after every multi-line function signature
@@ -115,12 +92,17 @@
   gofumpt:
     extra-rules: false
   cyclop:
-      # the maximal code complexity to report
-      max-complexity: 20
-  #  depguard:
-  #    Main:
-  #      deny:
-  #        - github.com/OpenPeeDeeP/depguard # this is just an example
+    # the maximal code complexity to report
+    max-complexity: 20
+  depguard:
+    rules:
+      prevent_unmaintained_packages:
+        list-mode: lax # allow unless explicitly denied
+        files:
+          - $all
+        deny:
+          - pkg: io/ioutil
+            desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
 
 linters:
   enable-all: true
@@ -128,46 +110,35 @@
   fast: false
   disable:
     - exhaustruct
-    - exhaustivestruct
+    - err113
     - forbidigo
     - funlen
-    - gas
     - gochecknoglobals
     - gochecknoinits
     - godox
-    - goerr113
     - gomnd
     - gomoddirectives
+    - gosec
+    - inamedparam
     - ireturn
+    - mnd
     - nestif
     - nonamedreturns
-    - nosnakecase
     - paralleltest
+    - tagalign
     - tagliatelle
     - thelper
-    - typecheck
     - varnamelen
     - wrapcheck
-    - depguard # Disabled because starting with golangci-lint 1.53.0 it doesn't allow denylist alone anymore
-    - tagalign
-    - inamedparam
     - testifylint # complains about our assert recorder and has a number of false positives for assert.Greater(t, thing, 1)
     - protogetter # complains about us using Value field on typed spec, instead of GetValue which has a different signature
-    # abandoned linters for which golangci shows the warning that the repo is archived by the owner
-    - interfacer
-    - maligned
-    - golint
-    - scopelint
-    - varcheck
-    - deadcode
-    - structcheck
-    - ifshort
-    # disabled as it seems to be broken - goes into imported libraries and reports issues there
-    - musttag
+    - perfsprint # complains about us using fmt.Sprintf in non-performance critical code, updating just kres took too long
+    - goimports # same as gci
+    - musttag # seems to be broken - goes into imported libraries and reports issues there
 
 issues:
-  exclude: []
-  exclude-rules: []
+  exclude: [ ]
+  exclude-rules: [ ]
   exclude-use-default: false
   exclude-case-sensitive: false
   max-issues-per-linter: 10
diff --git a/Dockerfile b/Dockerfile
index 8dfc43c..7a62e17 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,8 @@
-# syntax = docker/dockerfile-upstream:1.6.0-labs
+# syntax = docker/dockerfile-upstream:1.9.0-labs
 
 # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
 #
-# Generated on 2023-11-23T12:47:31Z by kres latest.
+# Generated on 2024-09-11T14:39:44Z by kres 8be5fa7.
 
 ARG TOOLCHAIN
 
@@ -10,28 +10,27 @@
 FROM scratch AS generate
 
 # runs markdownlint
-FROM docker.io/node:21.1.0-alpine3.18 AS lint-markdown
+FROM docker.io/oven/bun:1.1.26-alpine AS lint-markdown
 WORKDIR /src
-RUN npm i -g markdownlint-cli@0.37.0
-RUN npm i sentences-per-line@0.2.1
+RUN bun i markdownlint-cli@0.41.0 sentences-per-line@0.2.1
 COPY .markdownlint.json .
 COPY ./README.md ./README.md
-RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
+RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
 
 # base toolchain image
-FROM ${TOOLCHAIN} AS toolchain
+FROM --platform=${BUILDPLATFORM} ${TOOLCHAIN} AS toolchain
 RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev
 
 # build tools
 FROM --platform=${BUILDPLATFORM} toolchain AS tools
-ENV GO111MODULE on
+ENV GO111MODULE=on
 ARG CGO_ENABLED
-ENV CGO_ENABLED ${CGO_ENABLED}
+ENV CGO_ENABLED=${CGO_ENABLED}
 ARG GOTOOLCHAIN
-ENV GOTOOLCHAIN ${GOTOOLCHAIN}
+ENV GOTOOLCHAIN=${GOTOOLCHAIN}
 ARG GOEXPERIMENT
-ENV GOEXPERIMENT ${GOEXPERIMENT}
-ENV GOPATH /go
+ENV GOEXPERIMENT=${GOEXPERIMENT}
+ENV GOPATH=/go
 ARG DEEPCOPY_VERSION
 RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
 	&& mv /go/bin/deep-copy /bin/deep-copy
@@ -40,9 +39,6 @@
 	&& mv /go/bin/golangci-lint /bin/golangci-lint
 RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \
 	&& mv /go/bin/govulncheck /bin/govulncheck
-ARG GOIMPORTS_VERSION
-RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \
-	&& mv /go/bin/goimports /bin/goimports
 ARG GOFUMPT_VERSION
 RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
 	&& mv /go/bin/gofumpt /bin/gofumpt
@@ -62,15 +58,12 @@
 FROM base AS lint-gofumpt
 RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumpt -w .':\n${FILES}"; exit 1)
 
-# runs goimports
-FROM base AS lint-goimports
-RUN FILES="$(goimports -l -local github.com/siderolabs/go-blockdevice/ .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/go-blockdevice/ .':\n${FILES}"; exit 1)
-
 # runs golangci-lint
 FROM base AS lint-golangci-lint
 WORKDIR /src
 COPY .golangci.yml .
-ENV GOGC 50
+ENV GOGC=50
+RUN golangci-lint config verify --config .golangci.yml
 RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint --mount=type=cache,target=/go/pkg golangci-lint run --config .golangci.yml
 
 # runs govulncheck
diff --git a/Makefile b/Makefile
index 1aaa63c..268b45b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,35 @@
 # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
 #
-# Generated on 2023-11-23T12:47:31Z by kres latest.
+# Generated on 2024-09-11T14:39:44Z by kres 8be5fa7.
 
 # common variables
 
 SHA := $(shell git describe --match=none --always --abbrev=8 --dirty)
-TAG := $(shell git describe --tag --always --dirty)
+TAG := $(shell git describe --tag --always --dirty --match v[0-9]\*)
 ABBREV_TAG := $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined')
 BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
 ARTIFACTS := _out
+IMAGE_TAG ?= $(TAG)
+OPERATING_SYSTEM := $(shell uname -s | tr '[:upper:]' '[:lower:]')
+GOARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
 WITH_DEBUG ?= false
 WITH_RACE ?= false
 REGISTRY ?= ghcr.io
 USERNAME ?= siderolabs
 REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
-PROTOBUF_GO_VERSION ?= 1.31.0
-GRPC_GO_VERSION ?= 1.3.0
-GRPC_GATEWAY_VERSION ?= 2.18.1
-VTPROTOBUF_VERSION ?= 0.5.0
-DEEPCOPY_VERSION ?= v0.5.5
-GOLANGCILINT_VERSION ?= v1.55.2
-GOFUMPT_VERSION ?= v0.5.0
-GO_VERSION ?= 1.21.4
-GOIMPORTS_VERSION ?= v0.15.0
+PROTOBUF_GO_VERSION ?= 1.34.2
+GRPC_GO_VERSION ?= 1.5.1
+GRPC_GATEWAY_VERSION ?= 2.22.0
+VTPROTOBUF_VERSION ?= 0.6.0
+GOIMPORTS_VERSION ?= 0.24.0
+DEEPCOPY_VERSION ?= v0.5.6
+GOLANGCILINT_VERSION ?= v1.60.3
+GOFUMPT_VERSION ?= v0.7.0
+GO_VERSION ?= 1.23.0
 GO_BUILDFLAGS ?=
 GO_LDFLAGS ?=
 CGO_ENABLED ?= 0
 GOTOOLCHAIN ?= local
-GOEXPERIMENT ?= loopvar
 TESTPKGS ?= ./...
 KRES_IMAGE ?= ghcr.io/siderolabs/kres:latest
 CONFORMANCE_IMAGE ?= ghcr.io/siderolabs/conform:latest
@@ -60,12 +62,12 @@
 COMMON_ARGS += --build-arg=GRPC_GO_VERSION="$(GRPC_GO_VERSION)"
 COMMON_ARGS += --build-arg=GRPC_GATEWAY_VERSION="$(GRPC_GATEWAY_VERSION)"
 COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION="$(VTPROTOBUF_VERSION)"
+COMMON_ARGS += --build-arg=GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
 COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
 COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
-COMMON_ARGS += --build-arg=GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
 COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
 COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
-TOOLCHAIN ?= docker.io/golang:1.21-alpine
+TOOLCHAIN ?= docker.io/golang:1.23-alpine
 
 # help menu
 
@@ -88,13 +90,30 @@
 
 	docker buildx create --name local --use
 
+If running builds that needs to be cached aggresively create a builder instance with the following:
+
+	docker buildx create --name local --use --config=config.toml
+
+config.toml contents:
+
+[worker.oci]
+  gc = true
+  gckeepstorage = 50000
+
+  [[worker.oci.gcpolicy]]
+    keepBytes = 10737418240
+    keepDuration = 604800
+    filters = [ "type==source.local", "type==exec.cachemount", "type==source.git.checkout"]
+  [[worker.oci.gcpolicy]]
+    all = true
+    keepBytes = 53687091200
 
 If you already have a compatible builder instance, you may use that instead.
 
 ## Artifacts
 
 All artifacts will be output to ./$(ARTIFACTS). Images will be tagged with the
-registry "$(REGISTRY)", username "$(USERNAME)", and a dynamic tag (e.g. $(IMAGE):$(TAG)).
+registry "$(REGISTRY)", username "$(USERNAME)", and a dynamic tag (e.g. $(IMAGE):$(IMAGE_TAG)).
 The registry and username can be overridden by exporting REGISTRY, and USERNAME
 respectively.
 
@@ -109,11 +128,14 @@
 ifneq (, $(filter $(WITH_DEBUG), t true TRUE y yes 1))
 GO_BUILDFLAGS += -tags sidero.debug
 else
-GO_LDFLAGS += -s -w
+GO_LDFLAGS += -s
 endif
 
 all: unit-tests lint
 
+$(ARTIFACTS):  ## Creates artifacts directory.
+	@mkdir -p $(ARTIFACTS)
+
 .PHONY: clean
 clean:  ## Cleans up all artifacts.
 	@rm -rf $(ARTIFACTS)
@@ -133,7 +155,7 @@
 .PHONY: fmt
 fmt:  ## Formats the source code
 	@docker run --rm -it -v $(PWD):/src -w /src golang:$(GO_VERSION) \
-		bash -c "export GOEXPERIMENT=loopvar; export GOTOOLCHAIN=local; \
+		bash -c "export GOTOOLCHAIN=local; \
 		export GO111MODULE=on; export GOPROXY=https://proxy.golang.org; \
 		go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION) && \
 		gofumpt -w ."
@@ -141,9 +163,6 @@
 lint-govulncheck:  ## Runs govulncheck linter.
 	@$(MAKE) target-$@
 
-lint-goimports:  ## Runs goimports linter.
-	@$(MAKE) target-$@
-
 .PHONY: base
 base:  ## Prepare base toolchain
 	@$(MAKE) target-$@
@@ -156,16 +175,12 @@
 unit-tests-race:  ## Performs unit tests with race detection enabled.
 	@$(MAKE) target-$@  TARGET_ARGS="--allow security.insecure"
 
-.PHONY: coverage
-coverage:  ## Upload coverage data to codecov.io.
-	bash -c "bash <(curl -s https://codecov.io/bash) -f $(ARTIFACTS)/coverage-unit-tests.txt -X fix"
-
 .PHONY: lint-markdown
 lint-markdown:  ## Runs markdownlint.
 	@$(MAKE) target-$@
 
 .PHONY: lint
-lint: lint-golangci-lint lint-gofumpt lint-govulncheck lint-goimports lint-markdown  ## Run all linters for the project.
+lint: lint-golangci-lint lint-gofumpt lint-govulncheck lint-markdown  ## Run all linters for the project.
 
 .PHONY: rekres
 rekres:
@@ -178,8 +193,7 @@
 	@grep -E '^[a-zA-Z%_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
 
 .PHONY: release-notes
-release-notes:
-	mkdir -p $(ARTIFACTS)
+release-notes: $(ARTIFACTS)
 	@ARTIFACTS=$(ARTIFACTS) ./hack/release.sh $@ $(ARTIFACTS)/RELEASE_NOTES.md $(TAG)
 
 .PHONY: conformance
diff --git a/blockdevice/blkpg/blkpg_linux.go b/blockdevice/blkpg/blkpg_linux.go
index 28091e8..789bbaa 100644
--- a/blockdevice/blkpg/blkpg_linux.go
+++ b/blockdevice/blkpg/blkpg_linux.go
@@ -92,7 +92,6 @@
 
 		return f.Sync()
 	})
-
 	if err != nil {
 		return fmt.Errorf("failed to inform kernel: %w", err)
 	}
diff --git a/blockdevice/blockdevice.go b/blockdevice/blockdevice.go
index 01ed731..dc26274 100644
--- a/blockdevice/blockdevice.go
+++ b/blockdevice/blockdevice.go
@@ -20,7 +20,7 @@
 
 // IsOutOfSpaceError checks if provided error is 'out of space'.
 func IsOutOfSpaceError(err error) bool {
-	_, ok := err.(OutOfSpaceError) //nolint:errorlint
+	_, ok := err.(OutOfSpaceError)
 
 	return ok
 }
diff --git a/blockdevice/blockdevice_linux.go b/blockdevice/blockdevice_linux.go
index f568025..496931a 100644
--- a/blockdevice/blockdevice_linux.go
+++ b/blockdevice/blockdevice_linux.go
@@ -98,6 +98,7 @@
 		bd.g = g
 	} else {
 		var g *gpt.GPT
+
 		if g, err = gpt.Open(f); err != nil {
 			if errors.Is(err, gpt.ErrPartitionTableDoesNotExist) {
 				return bd, nil
@@ -223,8 +224,19 @@
 	}
 
 	_, 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).
diff --git a/blockdevice/partition/gpt/gpt.go b/blockdevice/partition/gpt/gpt.go
index 65d6a9e..8cf6b1b 100644
--- a/blockdevice/partition/gpt/gpt.go
+++ b/blockdevice/partition/gpt/gpt.go
@@ -475,13 +475,13 @@
 	// process remaining partitions: delete all the kernel partitions left, add new partitions from in-memory set
 	for j := i; j < len(kernelPartitions); j++ {
 		if err := blkpg.InformKernelOfDelete(g.f, 0, 0, int32(kernelPartitions[j].No)); err != nil {
-			return err
+			return fmt.Errorf("failed to delete partition %d: %w", kernelPartitions[j].No, err)
 		}
 	}
 
 	for j := i; j < len(newPartitions); j++ {
 		if err := blkpg.InformKernelOfAdd(g.f, newPartitions[j].FirstLBA, newPartitions[j].Length(), newPartitions[j].Number); err != nil {
-			return err
+			return fmt.Errorf("failed to add partition %d (first %d, length %d): %w", newPartitions[j].Number, newPartitions[j].FirstLBA, newPartitions[j].Length(), err)
 		}
 	}
 
diff --git a/blockdevice/partition/gpt/gpt_test.go b/blockdevice/partition/gpt/gpt_test.go
index 2448cc9..acc61a1 100644
--- a/blockdevice/partition/gpt/gpt_test.go
+++ b/blockdevice/partition/gpt/gpt_test.go
@@ -440,7 +440,7 @@
 	_, err = g.Add(efiSize, gpt.WithPartitionName("efi"))
 	suite.Require().NoError(err)
 
-	_, err = g.Add(0, gpt.WithPartitionName("system"))
+	_, err = g.Add(bootSize, gpt.WithPartitionName("system"))
 	suite.Require().NoError(err)
 
 	_, err = g.Add(0, gpt.WithPartitionName("config"), gpt.WithOffset(configStart), gpt.WithMaximumSize(true))
diff --git a/blockdevice/probe/probe.go b/blockdevice/probe/probe.go
index 021f24c..a6feea3 100644
--- a/blockdevice/probe/probe.go
+++ b/blockdevice/probe/probe.go
@@ -90,7 +90,7 @@
 func WithSingleResult() SelectOption {
 	count := 0
 
-	return func(device *ProbedBlockDevice) (bool, error) {
+	return func(*ProbedBlockDevice) (bool, error) {
 		if count > 0 {
 			return false, fmt.Errorf("got more than one blockdevice with provided criteria")
 		}
diff --git a/blockdevice/probe/probe_test.go b/blockdevice/probe/probe_test.go
index 054faab..d1a5357 100644
--- a/blockdevice/probe/probe_test.go
+++ b/blockdevice/probe/probe_test.go
@@ -96,7 +96,7 @@
 			part:  part32,
 		},
 	} {
-		suite.T().Run(tc.label, func(t *testing.T) {
+		suite.Run(tc.label, func() {
 			dev, err := probe.DevForPartitionLabel(suite.LoopbackDevice.Name(), tc.label)
 			suite.Require().NoError(err)
 
diff --git a/hack/release.sh b/hack/release.sh
index 9e5ad9e..428ec82 100755
--- a/hack/release.sh
+++ b/hack/release.sh
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
 #
-# Generated on 2022-03-28T13:13:16Z by kres 8bc4139-dirty.
+# Generated on 2024-09-11T14:39:44Z by kres 8be5fa7.
 
 set -e
 
@@ -44,9 +44,92 @@
     exit 1
   fi
 
+  if is_on_main_branch; then
+    update_license_files
+  fi
+
   git commit -s -m "release($1): prepare release" -m "This is the official $1 release."
 }
 
+function is_on_main_branch {
+  main_remotes=("upstream" "origin")
+  branch_names=("main" "master")
+  current_branch=$(git rev-parse --abbrev-ref HEAD)
+
+  echo "Check current branch: $current_branch"
+
+  for remote in "${main_remotes[@]}"; do
+    echo "Fetch remote $remote..."
+
+    if ! git fetch --quiet "$remote" &>/dev/null; then
+      echo "Failed to fetch $remote, skip..."
+
+      continue
+    fi
+
+    for branch_name in "${branch_names[@]}"; do
+      if ! git rev-parse --verify "$branch_name" &>/dev/null; then
+        echo "Branch $branch_name does not exist, skip..."
+
+        continue
+      fi
+
+      echo "Branch $remote/$branch_name exists, comparing..."
+
+      merge_base=$(git merge-base "$current_branch" "$remote/$branch_name")
+      latest_main=$(git rev-parse "$remote/$branch_name")
+
+      if [ "$merge_base" = "$latest_main" ]; then
+        echo "Current branch is up-to-date with $remote/$branch_name"
+
+        return 0
+      else
+        echo "Current branch is not on $remote/$branch_name"
+
+        return 1
+      fi
+    done
+  done
+
+  echo "No main or master branch found on any remote"
+
+  return 1
+}
+
+function update_license_files {
+  script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+  parent_dir="$(dirname "$script_dir")"
+  current_year=$(date +"%Y")
+  change_date=$(date -v+4y +"%Y-%m-%d" 2>/dev/null || date -d "+4 years" +"%Y-%m-%d" 2>/dev/null || date --date="+4 years" +"%Y-%m-%d")
+
+  # Find LICENSE and .kres.yaml files recursively in the parent directory (project root)
+  find "$parent_dir" \( -name "LICENSE" -o -name ".kres.yaml" \) -type f | while read -r file; do
+    temp_file="${file}.tmp"
+
+    if [[ $file == *"LICENSE" ]]; then
+      if grep -q "^Business Source License" "$file"; then
+        sed -e "s/The Licensed Work is (c) [0-9]\{4\}/The Licensed Work is (c) $current_year/" \
+          -e "s/Change Date:          [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/Change Date:          $change_date/" \
+          "$file" >"$temp_file"
+      else
+        continue # Not a Business Source License file
+      fi
+    elif [[ $file == *".kres.yaml" ]]; then
+      sed -E 's/^([[:space:]]*)ChangeDate:.*$/\1ChangeDate: "'"$change_date"'"/' "$file" >"$temp_file"
+    fi
+
+    # Check if the file has changed
+    if ! cmp -s "$file" "$temp_file"; then
+      mv "$temp_file" "$file"
+      echo "Updated: $file"
+      git add "$file"
+    else
+      echo "No changes: $file"
+      rm "$temp_file"
+    fi
+  done
+}
+
 if declare -f "$1" > /dev/null
 then
   cmd="$1"
@@ -55,7 +138,7 @@
 else
   cat <<EOF
 Usage:
-  commit:        Create the official release commit message.
+  commit:        Create the official release commit message (updates BUSL license dates if there is any).
   cherry-pick:   Cherry-pick a commit into a release branch.
   changelog:     Update the specified CHANGELOG.
   release-notes: Create release notes for GitHub release.