내 실수:
ln "99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png" /home/anon/foo.png
# ^ works fine ^
ln "99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png" /tmp/foo.png
ln: failed to create hard link '/tmp/foo.png' => '99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png': Invalid cross-device link
이 답변에는 다음과 같은 내용이 나와 있습니다.https://unix.stackexchange.com/a/108558/79280
/home 디렉토리는 /root 디렉토리와 동일한 파티션에 없을 가능성이 높습니다.
cat /etc/fstab을 사용하여 이를 쉽게 확인할 수 있습니다. 서로 다른 파티션 간에는 하드 링크를 만들 수 없으며 심볼릭 링크만 만들 수 있습니다.
그러나 보시다시피:
cat /etc/fstab 1 ✘
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=A189-F750 /boot/efi vfat umask=0077 0 2
UUID=11bc9e0c-1727-4df7-b357-0fc11f66444a swap swap defaults,noatime 0 0
UUID=acc6e22f-a4d8-4766-bf57-ae13838bd5a8 / xfs defaults,noatime 0 1
이는 /tmp/
과 가 /home/
장착 지점에 있어야 함을 나타냅니다. 이것은 버그일까요, 아니면 /tmp/
제가 인식하지 못하는 특별한 동작이 있는 것일까요?
또한 이것은 xfs에만 해당됩니까? ext4를 테스트할 머신이 없습니다.
편집하다:
댓글에서 추천하는 명령어를 사용하세요.
cat /proc/self/mountinfo 1 ✘
24 29 0:22 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw
25 29 0:23 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sys rw
26 29 0:5 / /dev rw,nosuid,relatime shared:2 - devtmpfs dev rw,size=8009848k,nr_inodes=2002462,mode=755,inode64
27 29 0:24 / /run rw,nosuid,nodev,relatime shared:12 - tmpfs run rw,mode=755,inode64
28 25 0:25 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:7 - efivarfs efivarfs rw
29 1 259:3 / / rw,noatime shared:1 - xfs /dev/nvme0n1p3 rw,attr2,inode64,logbufs=8,logbsize=32k,noquota
30 25 0:6 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:8 - securityfs securityfs rw
31 26 0:26 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw,inode64
32 26 0:27 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
33 25 0:28 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:9 - cgroup2 cgroup2 rw,nsdelegate,memory_recursiveprot
34 25 0:29 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:10 - pstore pstore rw
35 25 0:30 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:11 - bpf none rw,mode=700
36 24 0:31 / /proc/sys/fs/binfmt_misc rw,relatime shared:13 - autofs systemd-1 rw,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1148
37 26 0:21 / /dev/mqueue rw,nosuid,nodev,noexec,relatime shared:14 - mqueue mqueue rw
38 26 0:32 / /dev/hugepages rw,relatime shared:15 - hugetlbfs hugetlbfs rw,pagesize=2M
39 25 0:7 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:16 - debugfs debugfs rw
40 25 0:11 / /sys/kernel/tracing rw,nosuid,nodev,noexec,relatime shared:17 - tracefs tracefs rw
41 25 0:33 / /sys/kernel/config rw,nosuid,nodev,noexec,relatime shared:18 - configfs configfs rw
42 36 0:34 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime shared:19 - binfmt_misc binfmt_misc rw
44 25 0:35 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:20 - fusectl fusectl rw
142 29 0:37 / /tmp rw,nosuid,nodev shared:63 - tmpfs tmpfs rw,size=8019684k,nr_inodes=409600,inode64
149 29 259:1 / /boot/efi rw,relatime shared:77 - vfat /dev/nvme0n1p1 rw,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro
445 27 0:43 / /run/user/1000 rw,nosuid,nodev,relatime shared:242 - tmpfs tmpfs rw,size=1603936k,nr_inodes=400984,mode=700,uid=1000,gid=1001,inode64
514 445 0:45 / /run/user/1000/gvfs rw,nosuid,nodev,relatime shared:278 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1000,group_id=1001
531 445 0:46 / /run/user/1000/doc rw,nosuid,nodev,relatime shared:297 - fuse.portal portal rw,user_id=1000,group_id=1001
그리고
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8009848k,nr_inodes=2002462,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p3 on / type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1148)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=8019684k,nr_inodes=409600,inode64)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1603936k,nr_inodes=400984,mode=700,uid=1000,gid=1001,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1001)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1001)
답변1
귀하의 데이터에 따르면 이는 /tmp
별도의 파일 시스템(tmpfs)입니다.
142 29 0:37 / /tmp rw,nosuid,nodev shared:63 - tmpfs tmpfs rw,size=8019684k,nr_inodes=409600,inode64
다음 방법으로 이 동작을 비활성화할 수 있습니다.
sudo systemctl mask tmp.mount
이 경우 /tmp
루트 파일 시스템에 속하게 됩니다. 다시 시작해야 합니다.