.. _deduplication:

How does the deduplication work?
************************************

The process of removing redundant files and replacing them by NTFS hardlinks with TreeSize is called **deduplication**. This will reduce the disk space that is blocked by your duplicate files.

Instead of having each of the files take up individual space on your hard disk, TreeSize removes all duplicate files and keeps only one of them.

The files that were removed will be replaced by hardlinks, which will then point to the remaining data (See: :ref:`notesonntfs`).

The data is now shared shared by all the hardlinks for this file, as shown in the image below.

.. image:: /images/Deduplication.png
   :width: 100%
   :align: center

These hardlinks can be used like any normal file. You will not notice any difference, except that the data is now shared between the other links. In fact, they are not different to any normal file, except that they do not occupy their own space.

Which of the duplicate files will be replaced?
=================================================

If you checkmark all files of a duplicates group, TreeSize will pick the file with the newest "Last modified" date and use it as "master" for this group. All other files will be removed and replaced by hardlinks, which point towards the master file.

If you want to manually select a master file, you can leave one of the files in a duplicates group unchecked. This file will then not be replaced, but used as master instead.

.. note::

    Unfortunately, Windows Explorer does not show the size difference for a deduplicated file, or the folder that it is located in. `Read our knowledge base <https://knowledgebase.jam-software.com/7259>`_ for more information.

.. note::

    You cannot use hardlinks to replace files located on different hard drives.

.. note::

    You cannot use hardlinks to replace files located on different hard drives.

.. note::

    You cannot use hardlinks to replace files located on different hard drives.

.. note::

    All hardlinks pointing to the same file share the same "Security Description" (access permissions). Deduplication will apply a unified set of permissions to the one physical remaining file.