Documentation
¶
Overview ¶
Package apfsclone provides tools to make and check APFS clones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneDir ¶
CloneDir recursively creates APFS clones of all files in src at dst.
src must be a directory, not a symbolic link to a directory. dst must not exist. Both must be on the same APFS volume.
This operation uses copyfile(3) with COPYFILE_CLONE|COPYFILE_RECURSIVE under the hood, with extra checks to make sure contents must be cloned, instead of only opportunistically cloned. If you want more flexibility with flags and/or progress reporting, check out https://pkg.go.dev/go-darwin.dev/apfs#CopyFile.
func CloneFile ¶
CloneFile creates an APFS clone of src at dst.
src must be a file. dst must not exist. Both must be on the same APFS volume. Symbolic link is not followed and cloned as is.
This operation uses copyfile(3) with COPYFILE_CLONE_FORCE under the hood. If you want more flexibility with flags, check out https://pkg.go.dev/go-darwin.dev/apfs#CopyFile.
func IsOnAPFSVolume ¶
IsOnAPFSVolume checks whether the given path is on an APFS volume. Symbolic link is not followed.
Types ¶
type CloneCheckResult ¶
type CloneCheckResult int
const ( // Unable to determine if checked files are APFS clones. UnknownResult CloneCheckResult = iota // Checked files are APFS clones. AreClones // Checked files are not APFS clones. NotClones // Checked files reference the same inode on disk. SameInode // Both checked files are empty, making the question moot. BothEmpty )
func FilesAreAPFSClones ¶
func FilesAreAPFSClones(f1, f2 string) (result CloneCheckResult, err error)
FilesAreAPFSClones checks whether the two files are APFS clones of each other. Symbolic links are not followed.
The checking is done by comparing the physical location of each block of both files (if they pass some basic similarity checks). Credit to https://github.com/dyorgio/apfs-clone-checker for the idea.
func (CloneCheckResult) String ¶
func (r CloneCheckResult) String() string