Root-Filesystem
/tmp 如何連結到 /var/tmp
我已經閱讀了 /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)"
根據@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: -