From 3c1a457ae1fb2d2c0327c7589fc9bf8540b0fbf2 Mon Sep 17 00:00:00 2001 From: Jxt-Eli Date: Thu, 14 May 2026 08:44:07 +0000 Subject: [PATCH 1/2] fix: change default artifact temp dir to storage partition to prevent disk full errors during extraction --- CubeMaster/pkg/templatecenter/template_image.go | 3 ++- README.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CubeMaster/pkg/templatecenter/template_image.go b/CubeMaster/pkg/templatecenter/template_image.go index a1c99590..0aea64c1 100644 --- a/CubeMaster/pkg/templatecenter/template_image.go +++ b/CubeMaster/pkg/templatecenter/template_image.go @@ -2005,7 +2005,8 @@ func artifactWorkRootDir() string { if value := strings.TrimSpace(os.Getenv("CUBEMASTER_ROOTFS_ARTIFACT_DIR")); value != "" { return value } - return filepath.Join(os.TempDir(), "cubemaster-rootfs-artifacts") + storeRoot := artifactStoreRootDir() + return filepath.Join(storeRoot, "tmp", "cubemaster-rootfs-artifacts") } func artifactStoreRootDir() string { diff --git a/README.md b/README.md index de7758c6..b9154869 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,8 @@ Cube Sandbox requires an x86_64 Linux environment with KVM support — **WSL 2** > - **Windows users**: run `wsl --install` in an admin PowerShell to set up WSL 2 (requires Windows 11 22H2+, with nested virtualization enabled in BIOS / WSL). > - **Bare-metal / physical machine users**: grab an x86_64 Linux physical machine, or rent a bare-metal server from a cloud provider. > - **Ordinary cloud VM users**: no bare-metal required — install the PVM host kernel to enable KVM on any standard cloud VM. See [PVM Deployment](./docs/guide/pvm-deploy.md). +> +> **NOTE on storage**: Ensure the partition hosting the CubeMaster storage directory (usually `/data`) has at least 20GB of free space for template creation. Once your environment is ready, launch your first sandbox in four steps: From 7e3288cdbfc7582d846b5586680d39c0938f7171 Mon Sep 17 00:00:00 2001 From: Jxt-Eli Date: Fri, 15 May 2026 11:48:52 +0000 Subject: [PATCH 2/2] fix: improve cubemaster extraction directory selection Signed-off-by: Jxt-Eli --- .../pkg/templatecenter/template_image.go | 21 +++++++++++++++++-- README.md | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CubeMaster/pkg/templatecenter/template_image.go b/CubeMaster/pkg/templatecenter/template_image.go index 0aea64c1..46e67b8c 100644 --- a/CubeMaster/pkg/templatecenter/template_image.go +++ b/CubeMaster/pkg/templatecenter/template_image.go @@ -72,6 +72,7 @@ const ( fallbackArtifactStoreDir = "cubemaster-rootfs-artifacts-store" rootfsWritableVolumeName = "cube_rootfs_rw" defaultDistributionWorkers = 4 + requiredExtractionSpace = 20 << 30 ) var getTemplateImageConfig = config.GetConfig @@ -2000,13 +2001,29 @@ func artifactModelToInfo(record *models.RootfsArtifact) *types.RootfsArtifactInf LastError: record.LastError, } } +func checkPartition(tempPath string) error { + var stat syscall.Statfs_t + err := syscall.Statfs(tempPath, &stat) + if err != nil { + return fmt.Errorf("error! Failed to check disk space at %s: %w", tempPath, err) + } + available := stat.Bavail * uint64(stat.Bsize) + if available < requiredExtractionSpace { + return fmt.Errorf("error: not enough space on %s\nRequired 20GiB\n Available: %dGiB", tempPath, available>>30) + } + return nil +} func artifactWorkRootDir() string { + tempDir := os.TempDir() if value := strings.TrimSpace(os.Getenv("CUBEMASTER_ROOTFS_ARTIFACT_DIR")); value != "" { return value } - storeRoot := artifactStoreRootDir() - return filepath.Join(storeRoot, "tmp", "cubemaster-rootfs-artifacts") + if err := checkPartition(tempDir); err == nil{ + return filepath.Join(tempDir, "cubemaster-rootfs-artifacts") + } + fallbackDir := artifactStoreRootDir() + return filepath.Join(fallbackDir, "tmp", "cubemaster-rootfs-artifacts") } func artifactStoreRootDir() string { diff --git a/README.md b/README.md index b9154869..442f9aa0 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ Cube Sandbox requires an x86_64 Linux environment with KVM support — **WSL 2** > - **Bare-metal / physical machine users**: grab an x86_64 Linux physical machine, or rent a bare-metal server from a cloud provider. > - **Ordinary cloud VM users**: no bare-metal required — install the PVM host kernel to enable KVM on any standard cloud VM. See [PVM Deployment](./docs/guide/pvm-deploy.md). > -> **NOTE on storage**: Ensure the partition hosting the CubeMaster storage directory (usually `/data`) has at least 20GB of free space for template creation. +> **NOTE on storage**: Ensure the partition hosting the CubeMaster storage directory (usually `/data`) has at least 20GiB of free space for template creation. Once your environment is ready, launch your first sandbox in four steps: