Described is a technology by which a new volume or partition may be
created on a disk, e.g., by running a shrink program and then reclaiming
freed space. Shrink occurs online, while the user or system processes may
be otherwise using the disk for reads and writes. Further, the technology
operates while protecting snapshot versions of the volume. To shrink,
upon receiving a request to shrink a volume to within a boundary, new
allocations are restricted such that any allocation is to a volume area
within the boundary. Data is moved from outside the boundary to within
the boundary, and the shrink is committed when no volume data remains
outside the boundary. A reduced-size volume or partition that does not
include the specified region is committed when the data has been moved
out of the specified region. A new volume or partition may be freed that
corresponds to the region.