나는 /tmp와 /var/tmp의 차이점을 읽었으므로 이 질문에 관한 것이 아니라는 점에 유의하십시오. /tmp에 파일을 생성하면 /var/tmp에 나타납니다. 그러나 어느 디렉토리도 다른 디렉토리에 대한 심볼릭 링크로 나타나지 않습니다.
[root@l12662 /]# pwd; ll
/
total 32
lrwxrwxrwx. 1 root root 7 Aug 25 2017 bin -> usr/bin
dr-xr-xr-x. 4 root root 4096 Aug 25 2017 boot
drwxr-xr-x 21 root root 3560 Nov 18 23:32 dev
...
drwxrwxrwt. 27 root root 4096 Nov 24 08:18 tmp
...
[root@l12662 /]# cd /var
[root@l12662 var]# ll
total 12
drwxr-xr-x. 2 root root 19 Mar 28 2017 account
drwxr-xr-x. 2 root root 6 Mar 10 2016 adm
drwxr-xr-x. 10 root root 122 Aug 25 2017 cache
...
drwxrwxrwt. 27 root root 4096 Nov 24 08:18 tmp
...
연결 방법:
[root@l12662 tmp]# pwd; ls | grep test
/tmp
[root@l12662 tmp]# ls /var/tmp/ | grep test
[root@l12662 tmp]# pwd; touch test.me
/tmp
[root@l12662 tmp]# pwd; ls | grep test
/tmp
test.me
[root@l12662 tmp]# ls /var/tmp/ | grep test
test.me
[root@l12662 tmp]#
그런데 이것은 RHEL 7입니다.
[root@l12662 tmp]# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.4 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.4"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.4 (Maipo)"
답변1
@Gilles의 의견에서 제안한 대로 /tmp와 /var/tmp가 동일한 가상 볼륨에 마운트된 것처럼 보입니다.
[root@l12662 tmp]# grep /tmp /proc/mounts
/dev/mapper/rootvg-tmplv /tmp xfs rw,nosuid,nodev,noexec,relatime,attr2,inode64,noquota 0 0
/dev/mapper/rootvg-tmplv /var/tmp xfs rw,nosuid,nodev,noexec,relatime,attr2,inode64,noquota 0 0
[root@l12662 tmp]# stat /tmp /var/tmp
File: ‘/tmp’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd05h/64773d Inode: 64 Links: 27
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2021-11-24 08:30:34.016446287 -0700
Modify: 2021-11-24 08:30:55.398311353 -0700
Change: 2021-11-24 08:30:55.398311353 -0700
Birth: -
File: ‘/var/tmp’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd05h/64773d Inode: 64 Links: 27
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2021-11-24 08:30:34.016446287 -0700
Modify: 2021-11-24 08:30:55.398311353 -0700
Change: 2021-11-24 08:30:55.398311353 -0700
Birth: -