Dav*_*ers 2 linux raid centos sas fdisk
我在我的服务器中安装了 CentOS 5.7 64 位,在硬件 RAID 10 上有 4x300 GB SAS 驱动器。在安装时,我选择了默认分区。
以下是命令输出:
[root@server ~]# fdisk -l
Disk /dev/sda: 598.8 GB, 598879502336 bytes
255 heads, 63 sectors/track, 72809 cylinders
Units = cylinders de 16065 * 512 = 8225280 bytes
Boot Device Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 72809 584733870 8e Linux LVM
[root@server ~]# df -h
File System Size Used Free Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
493G 1,4G 466G 1% /
/dev/sda1 99M 13M 81M 14% /boot
tmpfs 24G 0 24G 0% /dev/shm
Run Code Online (Sandbox Code Playgroud)
那 100 GB 去哪儿了,我该如何添加?
提前致谢
你的问题有点有趣 - 实际上有 3 个问题:
注意:我将使用从我的一个系统中提取的数字,而不是您的数字,因为需要更多信息 - 尽管适用相同的数学。
1. GB(千兆字节)与 GiB(千兆字节)
硬盘驱动器几乎总是以 GB 出售。
fdisk -l /dev/xvda1
Disk /dev/xvda1: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Run Code Online (Sandbox Code Playgroud)
因此,该分区有 4294967296 字节 - 您可以看到数字 (MB) 只是其中的 1/1000 2。要转换为 GiB,我们将除以 1024 3:
4294967296 B / (1024 3 B/GiB) = 4GiB(或 4096MB,绝对不同于上面的数字)。
2.文件系统保留了一些df可以看到的块
首先,让我们找到我们的块大小:
dumpe2fs -h /dev/xvda1 | grep "Block size"
dumpe2fs 1.41.12 (17-May-2010)
Block size: 4096
Run Code Online (Sandbox Code Playgroud)
由于此系统上的块大小为 4096B,因此我在下面使用该值。(注意,df使用 4K = 4096 和 4KB = 4000):
df -B 4K
Filesystem 4K-blocks Used Available Use% Mounted on
/dev/xvda1 1032112 325035 696599 32% /
Run Code Online (Sandbox Code Playgroud)
您会期望已用 + 可用 = 总数(即 4K 块),但是:
325035+696599 = 1021634 =/= 1032112
Run Code Online (Sandbox Code Playgroud)
此缺失值是“保留块计数”:
dumpe2fs -h /dev/xvda1 | grep "Reserved block count"
dumpe2fs 1.41.12 (17-May-2010)
Reserved block count: 10478
Run Code Online (Sandbox Code Playgroud)
检查数学:
1021634 + 10478 = 1032112
Run Code Online (Sandbox Code Playgroud)
3.df看不见的缺失块
好吧,到目前为止,一切都很好,但数字仍然没有加起来。
我应该拥有的 4K 块总数是 4294967296 / 4096 = 1048576 您可以使用 dumpe2fs -h /dev/xvda1 | 的输出来验证这一点 grep "块计数"
dumpe2fs -h /dev/xvda1 | grep "Block count"
dumpe2fs 1.41.12 (17-May-2010)
Block count: 1048576
Run Code Online (Sandbox Code Playgroud)
所以,根据 fdisk 和 dumpe2fs 有 1048576 4K blocks 根据 df: 1032112 4K blocks 这意味着:1048576 - 1032112 = 16464 blocks are missing
在这里,您需要对文件系统有所了解。就我而言,我使用的是 ext4 - 它被分成几组。
首先,这是 dumpe2fs 的部分输出:
dumpe2fs -h /dev/xvda1
dumpe2fs 1.41.12 (17-May-2010)
Filesystem OS type: Linux
Inode count: 262144
Block count: 1048576
Reserved block count: 10478
Free blocks: 735865
Free inodes: 216621
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 511
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
RAID stride: 32582
Flex block group size: 16
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
First orphan inode: 15632
Journal backup: inode blocks
Journal features: journal_incompat_revoke
Journal size: 128M
Journal length: 32768
Journal sequence: 0x0006db26
Journal start: 7391
Run Code Online (Sandbox Code Playgroud)
每组有 32768 个块。我们总共有 1048576 个区块因此:1048576 / 32768 = 32 个组
如果您运行 dumpe2fs(不带 -h),您将获得所有组及其相关信息的长列表。例如,对于我的第一组:
Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0xdc79, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-512
Block bitmap at 513 (+513), Inode bitmap at 529 (+529)
Inode table at 545-1056 (+545)
13296 free blocks, 0 free inodes, 1487 directories
Free blocks: 10382, 11506-11537, 11672-11679, 11714-11727, 12169, 12173-12179, 12181-12185, 12938-12962, 12964-12969, 13105, 13217-13246, 13384-13390, 13392-13393, 13644-13647, 13707, 13712-13855, 16346-18395, 20442-22491, 22699-22701, 22748, 23053-31837, 32290-32408
Free inodes:
Run Code Online (Sandbox Code Playgroud)
您会在这里注意到一些事情:
我们可以通过以下方式找到我们的超级块列表:
dumpe2fs /dev/xvda1 | grep -i superblock
dumpe2fs 1.41.12 (17-May-2010)
Primary superblock at 0, Group descriptors at 1-1
Backup superblock at 32768, Group descriptors at 32769-32769
Backup superblock at 98304, Group descriptors at 98305-98305
Backup superblock at 163840, Group descriptors at 163841-163841
Backup superblock at 229376, Group descriptors at 229377-229377
Backup superblock at 294912, Group descriptors at 294913-294913
Backup superblock at 819200, Group descriptors at 819201-819201
Backup superblock at 884736, Group descriptors at 884737-884737
Run Code Online (Sandbox Code Playgroud)
因此,就我而言,有 1 个主要超级块和 7 个备份。
解决这个问题,我们得到:
做数学运算,我们发现:
24 groups * 514 block/group + 8 groups * 516 blocks/group = 16464 blocks
Run Code Online (Sandbox Code Playgroud)
这正好等于我们缺少的数字!
值得一提的是,还有一些额外的保留块(例如保留的 GDT 块)允许未来增长,但 df 包括在其计算中。此外,文件系统日志被 df 识别为已用空间(因此即使没有任何文件,也会使用 128MiB)
| 归档时间: |
|
| 查看次数: |
1724 次 |
| 最近记录: |