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

lfree發表於2018-08-06
[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 (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

# 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
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
# 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 | egrep "Reserved block count"
Reserved block count:     262144

# mount /u02
# df -h /u02
Filesystem            Size  Used Avail Use% Mounted on
/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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2199284/,如需轉載,請註明出處,否則將追究法律責任。

相關文章