http://bugs.winehq.org/show_bug.cgi?id=58155
Bug ID: 58155 Summary: Use space-saving APFS clones instead of copying file data blocks to each WINEPREFIX on macOS Product: Packaging Version: unspecified Hardware: x86-64 OS: MacOS Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-packages Assignee: wine-bugs@winehq.org Reporter: cemer99797@isorax.com CC: dimesio@earthlink.net
When a WINEPREFIX is created using Wine on macOS, files from the Wine .app are copied using actual copying of data blocks, instead of the space-saving Copy-on-Write cloning mechanism of APFS (Apple File System), which only references the already existing data blocks.
When using Gcenx's macOS package builds, the data blocks of files are copied (from I believe Wine.app/Contents/Resources/wine/lib/wine/) to $WINEPREFIX/drive_c/windows/. This wastes over 300 MB of space for each WINEPREFIX created, which can add up, especially as it's recommended to install each Windows app in its own WINEPREFIX. They should instead use APFS CoW clones (similar to Linux btrfs reflinks).
Solution: use APFS Copy-on-Write when creating WINEPREFIXes, so it is faster and saves space
How?: using the macOS terminal command `cp -c` uses CoW
see macOS's man pages for `cp(1)` and `clonefile(2)`
macOS 10.14 Mojave man pages online: https://www.unix.com/man_page/mojave/1/cp https://www.unix.com/man_page/mojave/2/clonefile/
A Stack Exchange answer mentioning that macOS's "`cp -c` is equivalent to [Linux] `cp --reflink=always` (not `auto`), and will fail when copy-on-write is not possible": https://unix.stackexchange.com/a/504330
APFS was released for macOS devices on September 25, 2017, with the release of macOS 10.13 High Sierra. (https://en.wikipedia.org/wiki/Apple_File_System#History)
Gcenx's Wine 10.0 and later package releases for macOS (https://github.com/Gcenx/macOS_Wine_builds/releases) only support macOS 10.15 Catalina and later. (macOS 10.12 Sierra though macOS 10.14 Mojave can be installed via MacPorts).
How to test that Wine is not currently using APFS CoW clones: open Disk Utility before creating a new WINEPREFIX, click on your Container disk and look at the free space. Now create a new WINEPREFIX, the free space will decrease by about 300 MB. Delete the WINEPREFIX and empty the trash, watch the free space grow back
http://bugs.winehq.org/show_bug.cgi?id=58155
--- Comment #1 from ToastyBug cemer99797@isorax.com --- Another option might be using symlinks to the files by pointing them to Wine.app/Contents/Resources/wine/lib/wine/, but that might introduce other issues (for example if a Windows program modifies files in its $WINEPREFIX/drive_c/windows/)
http://bugs.winehq.org/show_bug.cgi?id=58155
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|dimesio@earthlink.net | Component|wine-packages |-unknown Product|Packaging |Wine Version|unspecified |10.6
--- Comment #2 from Austin English austinenglish@gmail.com --- Not a packaging bug