我的系统中有一个卷组,由单个物理卷创建。
我正在创建两个逻辑卷 - 一个大小为 100M,另一个大小为 512M。
在 LV 上创建的任何 100M 大小的文件都不会显示出生时间属性。大小为 512M 的 LV 没有这个问题。
关于为什么会这样的任何线索?
物理卷和卷组:
# pvdisplay
--- Physical volume ---
PV Name /dev/sda4
VG Name VG_System
PV Size 400.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 102399
Free PE 38099
Allocated PE 64300
PV UUID Awnq0n-24v1-Z53P-MC09-3Fvv-dc0r-6QvAyX
# vgdisplay VG_System
--- Volume group ---
VG Name VG_System
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 25
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 24
Open LV 22
Max PV 0
Cur PV 1
Act PV 1
VG Size <400.00 GiB
PE Size 4.00 MiB
Total PE 102399
Alloc PE / Size 64300 / 251.17 GiB
Free PE / Size 38099 / 148.82 GiB
VG UUID Zg53rH-kuCI-dWKa-Uo3H-Mr2i-G2As-Wflm0d
第一个LV:
# lvcreate --stripes 1 -n testing -L 100M VG_System
Logical volume "testing" created.
# mkfs.ext4 /dev/VG_System/testing
mke2fs 1.45.6 (20-Mar-2020)
Discarding device blocks: done
Creating filesystem with 102400 1k blocks and 25688 inodes
Filesystem UUID: ac9c1782-7770-4031-bad8-9b76f7577467
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
# blkid /dev/VG_System/testing
/dev/VG_System/testing: UUID="ac9c1782-7770-4031-bad8-9b76f7577467" BLOCK_SIZE="1024" TYPE="ext4"
# mount /dev/VG_System/testing /mnt/test
# mount | grep test
/dev/mapper/VG_System-testing on /mnt/test type ext4 (rw,relatime,stripe=4)
# touch /mnt/test/a
# stat /mnt/test/a
File: /mnt/test/a
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 252,23 Inode: 12 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2023-04-13 22:13:43.000000000 +0530
Modify: 2023-04-13 22:13:43.000000000 +0530
Change: 2023-04-13 22:13:43.000000000 +0530
Birth: -
这里的Birth
字段是空的。
第二个LV:
# lvcreate -n testing2 -L 512M VG_System
Logical volume "testing2" created.
# mkfs.ext4 /dev/VG_System/testing2
mke2fs 1.45.6 (20-Mar-2020)
Discarding device blocks: done
Creating filesystem with 131072 4k blocks and 32768 inodes
Filesystem UUID: 0b5e24a9-cdf1-4749-9089-bf0cf1495185
Superblock backups stored on blocks:
32768, 98304
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
# blkid /dev/VG_System/testing2
/dev/VG_System/testing2: UUID="0b5e24a9-cdf1-4749-9089-bf0cf1495185" BLOCK_SIZE="4096" TYPE="ext4"
# mount /dev/VG_System/testing2 /mnt/test2
# mount | grep test
/dev/mapper/VG_System-testing2 on /mnt/test2 type ext4 (rw,relatime)
# touch /mnt/test2/a
# stat /mnt/test2/a
File: /mnt/test2/a
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 252,24 Inode: 12 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2023-04-13 22:19:01.873047858 +0530
Modify: 2023-04-13 22:19:01.873047858 +0530
Change: 2023-04-13 22:19:01.873047858 +0530
Birth: 2023-04-13 22:19:01.873047858 +0530
注意确定它是否相关,但是第一个 LV 的安装选项有stripe=4
,而第二个没有这个。除此之外,两个 LV 是相似的。
# lvdisplay VG_System/testing
--- Logical volume ---
LV Path /dev/VG_System/testing
LV Name testing
VG Name VG_System
LV UUID n19sRr-SqHW-znjI-0fEW-MkQX-JRUn-MTmZHF
LV Write Access read/write
LV Creation host, time controller, 2023-04-13 22:12:45 +0530
LV Status available
# open 0
LV Size 100.00 MiB
Current LE 25
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:23
# lvdisplay VG_System/testing2
--- Logical volume ---
LV Path /dev/VG_System/testing2
LV Name testing2
VG Name VG_System
LV UUID 94oJKP-r2Ob-ReHr-sDSO-t3HY-isJB-ZtEPsq
LV Write Access read/write
LV Creation host, time controller, 2023-04-13 22:18:01 +0530
LV Status available
# open 1
LV Size 512.00 MiB
Current LE 128
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:24
这不是 LVM 的问题。这是 Ext4 的问题。
当文件系统大小小于 512 MB 时,Ext4 使用 Default Inode Size = 128 Bytes ,这不足以存储“扩展元数据”。
当文件系统大小超过 512 MB 时,Ext4 使用 Default Inode Size = 256 Bytes ,这足以存储“扩展元数据”,包括“出生时间”@offset 0x90 & offset 0x94。
更多详细信息:
https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Table
你可以试试这个:
这将在较小的文件系统上强制 Inode Size = 256。
更多详细信息:
https://manpages.debian.org/bullseye/e2fsprogs/mke2fs.8.en.html