diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 32fcfe17275c3833d06c10b1cf4a33edb98101cf..b7538a2f34972a0db5f0e286168ee446ce7ef37d 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -446,9 +446,7 @@ run_test 17e "symlinks: create recursive symlink (should return error) ===="
 
 test_17g() {
         mkdir -p $DIR/$tdir
-        for ((i = 0; i < 511; ++i)); do
-                LONGSYMLINK="${LONGSYMLINK}01234567"
-        done
+        LONGSYMLINK="$(dd if=/dev/zero bs=4095 count=1 | tr '\0' 'x')"
         ln -s $LONGSYMLINK $DIR/$tdir/$tfile
         ls -l $DIR/$tdir
 }