All Products
Search
Document Center

Alibaba Cloud Linux:Create hard links across project quotas

Last Updated:Jun 03, 2026

By default, ext4 file systems forbid hard links between directories that belong to different project IDs. Alibaba Cloud Linux 2 and Alibaba Cloud Linux 3 provide the /proc/sys/fs/hardlink_cross_projid kernel parameter to lift this restriction and allow hard links across project quota boundaries.

How project quotas work

Linux supports three types of disk quota: user quota, group quota, and project quota. A project quota tracks disk usage for all files and directories that share a project ID, regardless of which user or group owns them. Because a project quota can span multiple directories within a single file system, it gives administrators finer-grained control over disk usage than user or group quotas.

By default, ext4 enforces a restriction: you cannot create a hard link to a file if the source and target directories belong to different project IDs. This restriction preserves quota accuracy — a hard link makes one inode appear in two directories, which can cause the file's disk usage to be attributed to a different project than intended.

Supported environments

  • Alibaba Cloud Linux 2 or Alibaba Cloud Linux 3

  • ext4 file systems with project quotas configured

Parameter values

The /proc/sys/fs/hardlink_cross_projid parameter controls whether hard links can be created across project quota boundaries on ext4 file systems.

Value

Behavior

0 (default)

Hard links across project quotas are disabled

1

Hard links across project quotas are enabled

Alibaba Cloud Linux sets this parameter to 0 by default to preserve ext4 quota accuracy. Set it to 1 when cross-directory hard links are required and quota reporting across project boundaries is not a concern.

For more information, see the Documentation/sysctl/fs.txt kernel document. You can get 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.

Enable hard links across project quotas

Step 1: Check the current value

Run the following command to check whether cross-project hard links are enabled:

cat /proc/sys/fs/hardlink_cross_projid

Expected output:

0

A value of 0 means hard links across project quotas are disabled.

Step 2: Enable cross-project hard links

Run the following command to enable hard links across project quotas:

echo 1 > /proc/sys/fs/hardlink_cross_projid
Note: This change takes effect immediately but does not persist across reboots. To make the change persistent, add the following line to /etc/sysctl.conf or create a file in /etc/sysctl.d/: fs.hardlink_cross_projid = 1 Then run sysctl -p to apply the configuration.

Step 3: Verify the result

Run the following command to confirm the change:

cat /proc/sys/fs/hardlink_cross_projid

Expected output:

1

A value of 1 confirms that hard links across project quotas are enabled on ext4 file systems.