【澳门威斯尼人平台登录】Linux下利用tune2fs命令来查看硬盘相关信息,tune2fs调整保留块百分比

# mount /u02
# df -h /u02
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d1p1     1.7T  1.6T  103G  94% /u02

在Linux下让我们利用tune2fs来查看和硬盘有关的参数吧,恐怕这里有你所需的音信:

dumpe2fs 1.41.12 (17-May-2010)
Filesystem volume name:   home
Last mounted on:          <not available>
Filesystem UUID:          78a58693-dc1a-43c0-9eaf-6c0807626c14
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              16318464
Block count:              65241965
Reserved block count:     652419
Free blocks:              58319070
Free inodes:              16135620
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1008
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Filesystem created:       Fri Oct 14 16:13:01 2011
Last mount time:          Wed Feb 29 16:29:51 2012
Last write time:          Wed Feb 29 16:29:51 2012
Mount count:              5
Maximum mount count:      -1
Last checked:             Fri Oct 14 16:13:01 2011
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:          256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
First orphan inode:       8437776
Default directory hash:   half_md4
Directory Hash Seed:      0eddc0e6-7fa9-4226-8534-59b633b5e88b
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
日志大小:             128M
Journal length:           32768
Journal sequence:         0x006cea77
Journal start:            3735澳门威斯尼人平台登录 1

# umount /dev/cciss/c0d1p1
umount: /u02: device is busy
umount: /u02: device is busy

[ The End ]

linux中inode是个什么样概念吗?一言以蔽之inode是一个不能够重复的标号同样,每一种文件或目录对应多少个inode值,那么些inode包蕴怎样部分,有哪些效果与利益吧?这里拿ext3文件系统的inode数据布局来讲:
struct ext3_inode {
 __u16 i_mode;    /* File mode */
 __u16 i_uid;     /* Low 16 bits of Owner Uid */
 __u32 i_size;    /* 文件大小,单位是 byte */
 __u32 i_atime;   /* Access time 访谈时间*/
 __u32 i_ctime;   /* Creation time 创立时间*/
 __u32 i_mtime;   /* Modification time 改良时间*/
 __u32 i_dtime;   /* Deletion Time 删除时间*/
 __u16 i_gid;     /* Low 16 bits of Group Id */
 __u16 i_links_count;          /* Links count */
 __u32 i_blocks;               /* blocks 计数 */
 __u32 i_flags;                /* File flags */
 __u32 l_i_reserved1;          /* 能够忽视 */
 __u32 i_block[EXT3_N_BLOCKS]; /* 风流倜傥组 block 指针 ,指向数据文件在磁盘上的指针*/
 __u32 i_generation;           /* 能够忽视 */
 __u32 i_file_acl;             /* 能够忽视 */
 __u32 i_dir_acl;              /* 能够忽略 */
 __u32 i_faddr;                /* 可以忽视 */
 __u8  l_i_frag;               /* 能够忽视 */
 __u8  l_i_fsize;              /* 能够忽视 */
 __u16 i_pad1;                 /* 能够忽视 */
 __u16 l_i_uid_high;           /* 可以忽略 */
 __u16 l_i_gid_high;           /* 能够忽视 */
 __u32 l_i_reserved2;          /* 可以忽视 */
};
前边在(浅析ext3剔除文件慢的来头 http://www.linuxidc.com/Linux/2012-05/59492.htm)也大约研商过它。

SYS@xxxxdg> startup open read only;
ORACLE instance started.

[root@localhost ~] ~# tune2fs -l /dev/sdc1
tune2fs 1.35 (28-Feb-2004)
Filesystem volume name: /data2
Last mounted on: <not available>
Filesystem UUID: cc571d4e-715d-43fa-802b-50e30a3ccb16
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode filetype needs_recovery sparse_super large_file
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 36634624
Block count: 73240327
Reserved block count: 3662016
Free blocks: 72066127
Free inodes: 36634613
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1024
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16384
Inode blocks per group: 512
Filesystem created: Sat Jun 21 06:38:52 2008
Last mount time: Sat Jun 21 06:41:59 2008
Last write time: Sat Jun 21 06:41:59 2008
Mount count: 1
Maximum mount count: 34
Last checked: Sat Jun 21 06:38:52 2008
Check interval: 15552000 (6 months)
Next check after: Thu Dec 18 06:38:52 2008
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
Default directory hash: tea
Directory Hash Seed: db692f72-bbb3-43d4-8011-1664854a8364
Journal backup: inode blocks
[root@localhost ~] ~# tune2fs -l /dev/sde1
tune2fs 1.35 (28-Feb-2004)
Filesystem volume name: /data3
Last mounted on: <not available>
Filesystem UUID: 68985487-0e63-4c7c-a5f6-e2f36da55d33
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode filetype needs_recovery sparse_super large_file
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 36634624
Block count: 73240327
Reserved block count: 3662016
Free blocks: 72066127
Free inodes: 36634613
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1024
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16384
Inode blocks per group: 512
Filesystem created: Sat Jun 21 06:40:24 2008
Last mount time: Sat Jun 21 06:41:59 2008
Last write time: Sat Jun 21 06:41:59 2008
Mount count: 1
Maximum mount count: 26
Last checked: Sat Jun 21 06:40:24 2008
Check interval: 15552000 (6 months)
Next check after: Thu Dec 18 06:40:24 2008
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
Default directory hash: tea
Directory Hash Seed: 17a1e87f-434b-468d-8048-9a35b66b227c
Journal backup: inode blocks
[root@localhost ~] ~#

因为inode首假如挤占磁盘空间的,那么今日就研商一下inode分配与占用磁盘难点,早先听人说xfs文件系统inode占用的磁盘空间到达了一定多G,当然这是因为她的文件系统本来正是用来寄放在小文件的,所以导致inode占用的长空也十分大。

1.环境:
# cat /proc/version
Linux version 2.6.39-300.26.1.el5uek (mockbuild@ca-build56.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Thu Jan 3 18:31:38 PST 2013

澳门威斯尼人平台登录 2

在您为三个硬盘或是分区建好文件系统以往,文件系统已经分明了这块硬盘或是分区最后能有稍许inode被分配,那一个inode能占用多大的上空。查看三个硬盘或分区的文件系统新闻,能够透过dumpe2fs -h device_name 来查阅,例如本人的系统中一个分区/dev/sda8 (ext3State of Qatar
$ dumpe2fs -h /dev/sda8

# df -h /u02
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d1p1     1.7T  1.6T   20G  99% /u02
--//剩余20G.

# sync;sync
# umount /dev/cciss/c0d1p1
# tune2fs -r 262144 /dev/cciss/c0d1p1
tune2fs 1.39 (29-May-2006)
Setting reserved blocks count to 262144

# tune2fs -l /dev/cciss/c0d1p1
tune2fs 1.39 (29-May-2006)
Filesystem volume name:   /u02
Last mounted on:          <not available>
Filesystem UUID:          d9c0c411-25ea-4e21-b383-3ef446d2c064
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              219774976
Block count:              439520246
Reserved block count:     21976012

--//参照他事他说加以考察早前测验的链接:
--//注意假诺在mount状态下更改无效!!

Free blocks:              432573167  
Free inodes:              219774965  
First block:              0  
Block size:               4096

# tune2fs -l /dev/cciss/c0d1p1 | egrep "Reserved block count"
Reserved block count:     262144

3.开行数量库.略.
$ lsnrctl start

--//将来多了83G,应该不会再蒙受磁盘空间不足的标题在/u02分区.

--//原来那时候监听运转时的目录是/u02,结束监听进度.
$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-AUG-2018 08:29:12
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.76)(PORT=1521)))
The command completed successfully

[20180806]tune2fs调度保留块百分比.txt

# lsof /u02
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
tnslsnr 9361 oracle  cwd    DIR 104,17     4096    2 /u02
--//奇怪.监听进度怎么会涉嫌到/u02

--//临盆系统少年老成台dg磁盘空间满了.我前豆蔻梢头阵子已经将*convert参数修正,增添磁盘,不过那么些分区里面的数据文件还足以增进,那样仍旧存
--//在磁盘空间不足的气象,符合规律应该移动数据文件到别的分区,然后rename.倏然想起建设构造分区时有一定的保留区给root顾客,我们以此分
--//区磁盘比一点都不小临近2T,那样遵照5%的比例计算,有相近100G的空中大概浪费了.

Fragment size:            4096
Reserved GDT blocks:      919
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Thu Feb 23 09:42:17 2017
Last mount time:          Thu Feb 23 09:55:13 2017
Last write time:          Thu Feb 23 09:55:13 2017
Mount count:              3
Maximum mount count:      -1
Last checked:             Thu Feb 23 09:42:17 2017
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      6e38ec2b-9916-496f-a143-b9b22a7e1f09
Journal backup:           inode blocks

Total System Global Area 8.0973E+10 bytes
Fixed Size                  2261968 bytes
Variable Size            9663679536 bytes
Database Buffers         7.1135E+10 bytes
Redo Buffers              171487232 bytes
Database mounted.
Database opened.

DGMGRL> show database xxxxdg
Database - xxxxdg
  Enterprise Manager Name: xxxx_dg
  Role:                    PHYSICAL STANDBY
  Intended State:          APPLY-ON
  Transport Lag:           0 seconds (computed 0 seconds ago)
  Apply Lag:               0 seconds (computed 0 seconds ago)
  Apply Rate:              34.40 MByte/s
  Real Time Query:         ON
  Instance(s):
    xxxxdg
Database Status:
SUCCESS

# cat /proc/9361/environ  | tr '' 'n'| grep u02
PWD=/u02

--//21976012*4096/1024/1024/1024 = 83.83183288574218750000,保留84G.
--//实际上-m 1也是浪费,我动用-r参数保留一定数额的块.
--//保留1G ,1024*1024*1024/4096 = 262144

2.调解保留块百分比:
--//关闭数据库.
SYS@xxxxdg> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

本文由澳门威斯尼人平台登录发布于 操作系统,转载请注明出处:【澳门威斯尼人平台登录】Linux下利用tune2fs命令来查看硬盘相关信息,tune2fs调整保留块百分比

相关阅读