Skip to content

An open-source, faster Devin alternative

TypeScript

Revert "Merge pull request #167 from diggerhq/expand-rootfs"

Brian Reardon448679c106cf
diff --git a/internal/qemu/manager.go b/internal/qemu/manager.go
index bb857ec7..97168f8d 100644
--- a/internal/qemu/manager.go
+++ b/internal/qemu/manager.go
@@ -485,26 +485,6 @@ func (m *Manager) PrepareGoldenSnapshot() error {
}
log.Printf("qemu: golden: virtio_mem module loaded")
- // Grow rootfs filesystem to fill the expanded virtual disk.
- // The qcow2 overlay was resized to 20 GB but the ext4 filesystem still
- // matches the smaller base image. resize2fs expands it in-place.
- growCtx, growCancel := context.WithTimeout(context.Background(), 30*time.Second)
- growResp, growErr := agentClient.Exec(growCtx, &pb.ExecRequest{
- Command: "/bin/sh",
- Args: []string{"-c", "resize2fs /dev/vda"},
- RunAsRoot: true,
- })
- growCancel()
- if growErr != nil || (growResp != nil && growResp.ExitCode != 0) {
- stderr := ""
- if growResp != nil {
- stderr = growResp.Stderr
- }
- log.Printf("qemu: golden: resize2fs /dev/vda failed (non-fatal): %v %s", growErr, stderr)
- } else {
- log.Printf("qemu: golden: rootfs expanded to 20GB")
- }
-
// Unmount /home/sandbox and sync before snapshot — the golden migration state
// includes virtio-blk device state (ring buffers, pending I/O). If the data disk
// is mounted when we snapshot, those stale I/O ops will corrupt any fresh
@@ -1334,16 +1314,6 @@ func (m *Manager) Create(ctx context.Context, cfg types.SandboxConfig) (*types.S
}
vm.agent = agentClient
- // Grow rootfs filesystem if the disk is larger than the current ext4 fs.
- // Golden-forked sandboxes already have the grown fs; this covers cold boot.
- growCtx, growCancel := context.WithTimeout(context.Background(), 10*time.Second)
- agentClient.Exec(growCtx, &pb.ExecRequest{
- Command: "/bin/sh",
- Args: []string{"-c", "resize2fs /dev/vda 2>/dev/null"},
- RunAsRoot: true,
- })
- growCancel()
-
envsToInject := m.sealSandboxEnvs(context.Background(), id, netCfg, agentClient, cfg)
if len(envsToInject) > 0 {
envCtx, envCancel := context.WithTimeout(context.Background(), 5*time.Second)
diff --git a/internal/qemu/rootfs.go b/internal/qemu/rootfs.go
index ef4486b0..e9e131a7 100644
--- a/internal/qemu/rootfs.go
+++ b/internal/qemu/rootfs.go
@@ -32,13 +32,6 @@ func PrepareRootfs(baseImage, destPath string) error {
return fmt.Errorf("create qcow2 overlay: %w (%s)", err, strings.TrimSpace(string(out)))
}
- // Expand the virtual size to 20 GB. The qcow2 is thin-provisioned so host
- // disk usage stays proportional to actual writes, not virtual size.
- resizeCmd := exec.Command("qemu-img", "resize", destPath, "20G")
- if out, err := resizeCmd.CombinedOutput(); err != nil {
- return fmt.Errorf("resize rootfs overlay: %w (%s)", err, strings.TrimSpace(string(out)))
- }
-
return nil
}