天天看點

[20170928]tune4fs.txt

[20170928]tune4fs.txt

--//昨天做了使用tune2fs調整保留塊百分比的測試,今天才發現,我們生産分區不是ext3而是ext4.

--//我重複測試看看:

1.建立測試環境:

# dd if=/dev/zero of=100m bs=1M count=100

100+0 records in

100+0 records out

104857600 bytes (105 MB) copied, 0.272268 seconds, 385 MB/s

--//注:bs=1M,M要大寫.另外注意輸出的MB的機關,感覺這樣輸出不對.

# mkfs.ext4 100m

mke4fs 1.41.12 (17-May-2010)

100m is not a block special device.

Proceed anyway? (y,n) y

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

25688 inodes, 102400 blocks

5120 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=67371008

13 block groups

8192 blocks per group, 8192 fragments per group

1976 inodes per group

Superblock backups stored on blocks:

        8193, 24577, 40961, 57345, 73729

Writing inode tables: done

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or

180 days, whichever comes first.  Use tune4fs -c or -i to override.

# tune2fs -l 100m

tune2fs 1.39 (29-May-2006)

tune2fs: Filesystem has unsupported feature(s) while trying to open 100m

Couldn't find valid filesystem superblock.

--//無法擷取資訊.

# tune4fs -l 100m

tune4fs 1.41.12 (17-May-2010)

Filesystem volume name:   <none>

Last mounted on:          <not available>

Filesystem UUID:          1b697663-dd42-4290-88cb-df3face16aba

Filesystem magic number:  0xEF53

Filesystem revision #:    1 (dynamic)

Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize

Filesystem flags:         signed_directory_hash

Default mount options:    (none)

Filesystem state:         clean

Errors behavior:          Continue

Filesystem OS type:       Linux

Inode count:              25688

Block count:              102400

Reserved block count:     5120

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Free blocks:              93504

Free inodes:              25677

First block:              1

Block size:               1024

Fragment size:            1024

Reserved GDT blocks:      256

Blocks per group:         8192

Fragments per group:      8192

Inodes per group:         1976

Inode blocks per group:   247

Flex block group size:    16

Filesystem created:       Wed Sep 27 09:10:38 2017

Last mount time:          n/a

Last write time:          Wed Sep 27 09:10:38 2017

Mount count:              0

Maximum mount count:      20

Last checked:             Wed Sep 27 09:10:38 2017

Check interval:           15552000 (6 months)

Next check after:         Mon Mar 26 09:10:38 2018

Lifetime writes:          7678 kB

Reserved blocks uid:      0 (user root)

Reserved blocks gid:      0 (group root)

First inode:              11

Inode size:               128

Journal inode:            8

Default directory hash:   half_md4

Directory Hash Seed:      c9d363f1-2cc6-4f9f-8d91-3a407bae5b86

Journal backup:           inode blocks

2.測試:

# mount -o loop 100m /mnt/backup/

# df | egrep "backup|File"

Filesystem            Size  Used Avail Use% Mounted on

/home/oracle/100m      97M  5.6M   87M   7% /mnt/backup

# mkdir /mnt/backup/test

# chown oracle:oinstall /mnt/backup/test

# chmod 777 /mnt/backup/test

--//以oracle使用者執行:

$ dd if=/dev/zero of=/mnt/backup/test/96m bs=1M count=96

dd: writing `/mnt/backup/test/96m': No space left on device

87+0 records in

86+0 records out

90357760 bytes (90 MB) copied, 0.554884 seconds, 163 MB/s

# tune4fs -r 0 100m

Setting reserved blocks count to 0

$ rm /mnt/backup/test/96m

90357760 bytes (90 MB) copied, 0.521343 seconds, 173 MB/s

# umount /mnt/backup/

# tune4fs -l 100m | grep "Reserved block count:"

--//可以發現修改無效!!

/home/oracle/100m      97M   92M  5.2M  95% /mnt/backup

92+0 records in

91+0 records out

95600640 bytes (96 MB) copied, 0.501282 seconds, 191 MB/s

--//對比前面可以寫入更多内容.一樣注意要在umount狀态下修改才有效.

繼續閱讀