Andrey Smirnov f448cb4f3c
feat: bump boot partition size to 1000 MiB
With system extensions, size of the `initramfs` might increase
significantly. With 1000 MiB `/boot`, as we store `A` and `B` boot
directories, we have 500 MiB for each Talos boot (size of the kernel and
initramfs).

Fixes #5096

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-03-10 16:52:07 +03:00

30 lines
728 B
Go

// 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/.
package pkg
import (
"fmt"
"github.com/talos-systems/go-cmd/pkg/cmd"
)
const (
// RAWDiskSize is the minimum size disk we can create.
RAWDiskSize = 1246
)
// CreateRawDisk creates a raw disk by invoking the `dd` command.
func CreateRawDisk() (img string, err error) {
img = "/tmp/disk.raw"
seek := fmt.Sprintf("seek=%d", RAWDiskSize)
if _, err = cmd.Run("dd", "if=/dev/zero", "of="+img, "bs=1M", "count=0", seek); err != nil {
return "", fmt.Errorf("failed to create RAW disk: %w", err)
}
return img, nil
}