Skip to content

Commit 96c89ad

Browse files
authored
tart clone: cap automatic pruning at 100 GB (#1124)
1 parent b78fa6b commit 96c89ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/tart/Commands/Clone.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ struct Clone: AsyncParsableCommand {
7676
//
7777
// So, once we clone the VM let's try to claim the rest of space for the VM to run without errors.
7878
let unallocatedBytes = try sourceVM.sizeBytes() - sourceVM.allocatedSizeBytes()
79-
if unallocatedBytes > 0 {
80-
try Prune.reclaimIfNeeded(UInt64(unallocatedBytes), sourceVM)
79+
// Avoid reclaiming an excessive amount of disk space.
80+
let reclaimBytes = min(unallocatedBytes, 100 * 1024 * 1024 * 1024)
81+
if reclaimBytes > 0 {
82+
try Prune.reclaimIfNeeded(UInt64(reclaimBytes), sourceVM)
8183
}
8284
}, onCancel: {
8385
try? FileManager.default.removeItem(at: tmpVMDir.baseURL)

0 commit comments

Comments
 (0)