天天看點

[20180806]tune2fs調整保留塊百分比.txt

[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