'Dedup' is a free macOS app that finds identical files, replaces them with clones, and frees up storage space



The file system used in macOS, '

Apple File System (APFS) ', has a clone function that 'when copying a file, it creates only reference information to the original file without copying the data itself.' ' dedup ' is a command line tool that uses this clone function to search for files with the same content in the storage, keep only one actual file, and convert the others to clones, allowing you to free up storage space on your Mac without deleting files.

GitHub - ttkb-oss/dedup: dedup finds and clones duplicate files
https://github.com/ttkb-oss/dedup

◆Preparing to use dedup
First, download the dedup source code from GitHub and build it. Just launch the terminal and run the following commands one by one. Note that dedup only works on storage formatted with APFS.
[code]git clone https://github.com/ttkb-oss/dedup.git

cd dedup

make && sudo make install[/code]



Once the build is complete, run the dedup version check command to check if the build was successful. Note that 'V' is capitalized. If you use lowercase 'v', the file conversion process will be executed.
[code]./dedup -V[/code]



If the version information is displayed as shown below, it is OK.



This completes the build of dedup, but it is difficult to use in this state, so let's set up an alias so that it can be executed with just the command 'dedup'. First, go to your home directory and open the zsh configuration file '.zshrc'.
[code]cd

vim .zshrc[/code]



Add the line 'alias dedup='./$HOME/dedup/dedup'' to '.zshrc' and save it.



Now you can run dedup with the command 'dedup' no matter what directory you are in. To check that the alias is set correctly, try running the following command in any directory.
[code]dedup -V[/code]



If the version is displayed like this, it's OK.



◆Steps to free up space with dedup
Now that we are ready to use dedup, let's try it out. As an example, we created a directory containing 100 identical photos. At this point, the total free space in the storage is 25.31GB.



The directory size is 1.39GB.



First, to check how much space can be secured with dedup, go to the directory you want to process and execute the following command. The '-h' option displays the capacity in a human-friendly format, and the '-n' option only calculates the space that can be secured without performing the clone process.
dedup -h -n



The command execution result looks like this. We can see that 1GB of space can be reserved.



Now that we know how much space we can allocate, we can actually perform the cloning process with the following command:
[code]dedup -h[/code]



Processing complete.



When I check the Finder, the image files remain as they are, but the total free space in the storage has increased by 1.38GB to 26.69GB. In other words, only some of the files remain as actual files, and the other files are clones.



The directory information showed the same capacity as before the process was performed.



Dedup also has the ability to use hard links and symbolic links instead of clones. For more information, see the following link.

GitHub - ttkb-oss/dedup: dedup finds and clones duplicate files
https://github.com/ttkb-oss/dedup



in Review,   Software, Posted by log1o_hf