[20180806]tune2fs调整保留块百分比.txt
--//生产系统一台dg磁盘空间满了.我前一阵子已经将*convert参数修改,增加磁盘,但是这个分区里面的数据文件还可以增长,这样依旧存
--//在磁盘空间不足的情况,正常应该移动数据文件到别的分区,然后rename.突然想起建立分区时有一定的保留区给root用户,我们这个分
--//区磁盘很大接近2T,这样按照5%的比例计算,有将近100G的空间可能浪费了.
--//参考以前测试的链接:http://blog.itpub.net/267265/viewspace-2145428/=>[20170926]tune2fs调整保留块百分比.txt
--//注意如果在mount状态下修改无效!!
1.环境:
# cat /proc/version
Linux version 2.6.39-300.26.1.el5uek ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Thu Jan 3 18:31:38 PST 2013
# 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free blocks: 432573167
Free inodes: 219774965
First block: 0
Block size: 4096
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
--//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.
# umount /dev/cciss/c0d1p1
umount: /u02: device is busy
# lsof /u02
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
tnslsnr 9361 oracle cwd DIR 104,17 4096 2 /u02
--//奇怪.监听进程怎么会关联到/u02
# cat /proc/9361/environ | tr '\0' '\n'| grep u02
PWD=/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
# sync;sync
# tune2fs -r 262144 /dev/cciss/c0d1p1
Setting reserved blocks count to 262144
# tune2fs -l /dev/cciss/c0d1p1 | egrep "Reserved block count"
Reserved block count: 262144
# mount /u02
/dev/cciss/c0d1p1 1.7T 1.6T 103G 94% /u02
--//现在多了83G,应该不会再遇到磁盘空间不足的问题在/u02分区.
3.启动数据库.略.
$ lsnrctl start
SYS@xxxxdg> startup open read only;
ORACLE instance started.
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