By default, the ext4 file system has constraints, and you are not allowed to create hard links across project quotas. However, some scenarios require hard links to be created. Alibaba Cloud Linux 2 provides a custom interface that can bypass the constraints of the ext4 file system to create hard links across project quotas. This topic describes the interface and provides an example on how to use the interface.
Linux distributions support the following disk quota modes: user quota, group quota, and project quota. Project quotas provide more fine-grained disk quotas than user or group quotas. Project quotas identify directories and files within file systems by project ID. This topic describes how to create a hard link across project ID directories in an ext4 file system.
The default value of the /proc/sys/fs/hardlink_cross_projid interface is 0. In this case, hard links cannot be created across project quotas. If the /proc/sys/fs/hardlink_cross_projid interface is set to 1, you can bypass the constraints of the ext4 file system to create hard links across project quotas.
For more information about the interface, see
Documentation/sysctl/fs.txt. You can obtain the kernel document from the Debuginfo package and the source code
package of Alibaba Cloud Linux 2. For more information, see Use Alibaba Cloud Linux 2.
A value of
0is returned, which indicates that hard links cannot be created across project quotas.
echo 1 > /proc/sys/fs/hardlink_cross_projid