Ext4 don't support de duplication, against p.e. btrfs, bcachefs and ZFS, reduplication by standard.
How to get support of reduplication for Ext4 ?
The main question is - what do you mean by de-duplication? It could mean various things, but one thing that comes to mind may be "detect two files with the same content and replace one of them with a hard link to the other". The main disadvantage with that is that these two files are now essentially the same file, and if you now edit one of them - the other will also change, and this is more often than not isn't what you want.
As such, you cannot de-duplicate files on ext4 file systems, in a way that (for example) BTRFS does that makes sense: in BTRFS you can save space by having two file names point to the same extent and because Copy On Write (COW), when one is changed and should no longer be a duplicate of the other, you get two different files. So a possible correct answer may be: don't use ext4, use BTRFS.
You can do also the follow:
Run what you like inside a BTRFS, bcachefs or ZFS using VM on top of ext4.
One other way are:
Run it inside a .qcow2 format using VM. You can create and use the .qcow2 based virtual hard disk by QEMU and VirtualBox.
Existing non .qcow VM`s can converted on follow way:
qemu-img convert -f vmdk -O qcow2 image.vmdk image.qcow2 For more formats and documentation, see:
https://docs.openstack.org/image-guide/convert-images.html The qcow2 documentation can be found:
https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/qcow2.txt truncate a file / files and mkfs on them, like shown in <wiki.archlinux.org/title/ZFS/Virtual_disks>.