File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,14 @@ struct Clone: AsyncParsableCommand {
71
71
72
72
try lock. unlock ( )
73
73
74
- // APFS is doing copy-on-write so the above cloning operation (just copying files on disk)
74
+ // APFS is doing copy-on-write, so the above cloning operation (just copying files on disk)
75
75
// is not actually claiming new space until the VM is started and it writes something to disk.
76
- // So once we clone the VM let's try to claim a little bit of space for the VM to run.
77
- try Prune . reclaimIfNeeded ( UInt64 ( sourceVM. allocatedSizeBytes ( ) ) , sourceVM)
76
+ //
77
+ // So, once we clone the VM let's try to claim the rest of space for the VM to run without errors.
78
+ let unallocatedBytes = try sourceVM. sizeBytes ( ) - sourceVM. allocatedSizeBytes ( )
79
+ if unallocatedBytes > 0 {
80
+ try Prune . reclaimIfNeeded ( UInt64 ( ) , sourceVM)
81
+ }
78
82
} , onCancel: {
79
83
try ? FileManager . default. removeItem ( at: tmpVMDir. baseURL)
80
84
} )
You can’t perform that action at this time.
0 commit comments