Copying a 20 GB virtual machine before trying something risky can take minutes and doubles the space it uses. On APFS it doesn’t have to.
The -c flag of the macOS cp asks for a clone through clonefile. The copy shares its data blocks with the original until one of them changes:
cp -c ~/VMs/ubuntu.img ~/VMs/ubuntu-before-upgrade.img
A 200 MB test file cloned in a few milliseconds here, and the size of the file hardly matters. Free space barely changes. Only the blocks you later change in either copy take new space.
Finder does the same thing when you duplicate a file with Command-D, but in scripts I like being explicit. For whole folders, cp -c -R clones every file inside.
It only works within one APFS volume. Copy to another disk or a network share and cp quietly falls back to a normal copy, which is safe but slow. Also keep in mind what a clone is not: it is not a backup. If the disk dies, both copies are gone, because they live on the same blocks. And the space saving makes the Finder size misleading, since each clone shows the full size even though they share it.
Further reading: cp man page (macOS), About Apple File System (Apple Developer)