您的位置:时时app平台注册网站 > 时时app平台注册网站 > [20180806]tune2fs调整保留块百分比.txt【时时app平台

[20180806]tune2fs调整保留块百分比.txt【时时app平台

2019-10-13 19:16

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

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

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)也简单研究过它。

--//参考以前测试的链接:
--//注意如果在mount状态下修改无效!!

时时app平台注册网站 1

在你为一个硬盘或是分区建好文件系统以后,文件系统已经确定了这块硬盘或是分区最后能有多少inode被分配,这些inode能占用多大的空间。查看一个硬盘或分区的文件系统信息,可以通过dumpe2fs -h device_name 来查看,比如我的系统中一个分区/dev/sda8 (ext3)
$ dumpe2fs -h /dev/sda8

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

[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占用的空间也很大。

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.

[ The End ]

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时时app平台注册网站 2

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

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

--//原来当时监听启动时的目录是/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

3.启动数据库.略.
$ lsnrctl start

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

# 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

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

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

--//生产系统一台dg磁盘空间满了.我前一阵子已经将*convert参数修改,增加磁盘,但是这个分区里面的数据文件还可以增长,这样依旧存
--//在磁盘空间不足的情况,正常应该移动数据文件到别的分区,然后rename.突然想起建立分区时有一定的保留区给root用户,我们这个分
--//区磁盘很大接近2T,这样按照5%的比例计算,有将近100G的空间可能浪费了.

--//现在多了83G,应该不会再遇到磁盘空间不足的问题在/u02分区.

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

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

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

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

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

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

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

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

本文由时时app平台注册网站发布于时时app平台注册网站,转载请注明出处:[20180806]tune2fs调整保留块百分比.txt【时时app平台

关键词: