mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-10 23:21:34 +02:00
GCP does not consider generated .tar file to be valid. This reverts commit b2507b41d250b989b9c13ad23e16202cd53a18d2. Refs #4023. Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@talos-systems.com>
30 lines
727 B
Go
30 lines
727 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 = 546
|
|
)
|
|
|
|
// 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
|
|
}
|