据说ext3支持文件时间戳精度高达几秒,而ext4支持高达纳秒...
发生的事情是,我的旧VPS运行ext3文件系统的Ubuntu 12.04一直(据我所记得)一直很好地支持纳秒,如下所示:
File: `auth.log'
Size: 147744 Blocks: 304 IO Block: 4096 regular file
Device: 800h/2048d Inode: 32019 Links: 1
Access: (0640/-rw-r-----) Uid: ( 101/ syslog) Gid: ( 4/ adm)
Access: 2020-03-20 00:18:33.634687690 -0300
Modify: 2020-03-24 05:12:48.777610222 -0300
Change: 2020-03-24 05:12:48.777610222 -0300
Birth: -
[mount
摘录:
/dev/sda on / type ext3 (rw,noatime,errors=remount-ro)
stat -f
:
File: "auth.log"
ID: 5483af2794a91010 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 3870084 Free: 272230 Available: 75643
Inodes: Total: 923520 Free: 829980
root@mail:~# df -mT
Filesystem Type 1M-blocks Used Available Use% Mounted on
/dev/sda ext3 15118 14055 296 98% /
devtmpfs devtmpfs 1973 1 1973 1% /dev
none tmpfs 395 1 395 1% /run
none tmpfs 5 0 5 0% /run/lock
none tmpfs 1973 0 1973 0% /run/shm
现在,我购买了一个新的VPS,将其更新为Ubuntu 20.04(测试版),它的文件系统安装为ext4 ...
File: auth.log
Size: 723967 Blocks: 1424 IO Block: 4096 regular file
Device: ca03h/51715d Inode: 398412 Links: 1
Access: (0640/-rw-r-----) Uid: ( 104/ syslog) Gid: ( 4/ adm)
Access: 2020-03-24 00:00:05.676000000 -0300
Modify: 2020-03-24 05:14:56.644000000 -0300
Change: 2020-03-24 05:14:56.644000000 -0300
Birth: -
[mount
摘录:
/dev/xvda3 on / type ext4 (rw,noatime,nobarrier,errors=remount-ro,stripe=32564)
但是奇怪的是stat -f
说它是ext3:
File: "auth.log"
ID: 7e8a03105e52b018 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 9857995 Free: 7434726 Available: 7007355
Inodes: Total: 2505120 Free: 2403794
root@mailnew:~# df -mT
Filesystem Type 1M-blocks Used Available Use% Mounted on
udev devtmpfs 430 0 430 0% /dev
tmpfs tmpfs 95 2 94 2% /run
/dev/xvda3 ext4 38508 9466 27373 26% /
tmpfs tmpfs 473 0 473 0% /dev/shm
tmpfs tmpfs 5 0 5 0% /run/lock
tmpfs tmpfs 473 0 473 0% /sys/fs/cgroup
/dev/loop0 squashfs 54 54 0 100% /snap/lxd/11348
/dev/loop1 squashfs 92 92 0 100% /snap/core/8689
/dev/xvda1 ext4 727 183 502 27% /boot
tmpfs tmpfs 95 0 95 0% /run/user/0
最后,我的问题是>>:
为什么我的旧ext3系统支持纳秒精度?
为什么新的ext4限制为毫秒?它实际上是格式化为ext3吗?
我如何找出问题所在,并在新的秒中启用纳秒级?
据说ext3支持文件时间戳精度高达几秒,ext4高达纳秒...发生的是,我的旧VPS始终运行带有ext3文件系统的Ubuntu 12.04(据我所知...
您所看到的是几个实现细节的结果,因此请做好准备,让我们从一些背景入手。