第7章 - 高度な Linux サーバ管理技術

|

SMART (7-2)

SMART は BIOS で設定する物もある。パッケージは smartmontools
DELL System 745 BIOS メニュー

Drivers
 + SMART Reporting
 		Off 		[ On ]

# smartctl -a /dev/sda
実行例
smartctl version 5.38 [i686-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF INFORMATION SECTION === ( -i option ) Device Model: ST3500413AS Serial Number: Z2ATEFFF Firmware Version: JC45 User Capacity: 500,107,862,016 bytes Device is: Not in smartctl database [for details use: -P showall] ATA Version is: 8 ATA Standard is: ATA-8-ACS revision 4 Local Time is: Sat Sep 8 16:43:17 2012 JST SMART support is: Available - device has SMART capability. SMART support is: Enabled === START OF READ SMART DATA SECTION === (-c option) SMART overall-health self-assessment test result: PASSED General SMART Values: Offline data collection status: (0x82) Offline data collection activity was completed without error. Auto Offline Data Collection: Enabled. Self-test execution status: ( 0) The previous self-test routine completed without error or no self-test has ever been run. Total time to complete Offline data collection: ( 600) seconds. Offline data collection capabilities: (0x7b) SMART execute Offline immediate. Auto Offline data collection on/off support. Suspend Offline collection upon new command. Offline surface scan supported. Self-test supported. Conveyance Self-test supported. Selective Self-test supported. SMART capabilities: (0x0003) Saves SMART data before entering power-saving mode. Supports SMART auto save timer. Error logging capability: (0x01) Error logging supported. General Purpose Logging supported. Short self-test routine recommended polling time: ( 1) minutes. Extended self-test routine recommended polling time: ( 82) minutes. Conveyance self-test routine recommended polling time: ( 2) minutes. SCT capabilities: (0x103f) SCT Status supported. SCT Feature Control supported. SCT Data Table supported. SMART Attributes Data Structure revision number: 10 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000f 118 100 006 Pre-fail Always - 175800438 3 Spin_Up_Time 0x0003 100 100 000 Pre-fail Always - 0 4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 17 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0 7 Seek_Error_Rate 0x000f 063 060 030 Pre-fail Always - 2006293 9 Power_On_Hours 0x0032 099 099 000 Old_age Always - 1393 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 17 183 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 0 184 Unknown_Attribute 0x0032 100 100 099 Old_age Always - 0 187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0 188 Unknown_Attribute 0x0032 100 098 000 Old_age Always - 9 189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0 190 Airflow_Temperature_Cel 0x0022 055 053 045 Old_age Always - 45 (Lifetime Min/Max 40/47) 194 Temperature_Celsius 0x0022 045 047 000 Old_age Always - 45 (0 23 0 0) 195 Hardware_ECC_Recovered 0x001a 028 021 000 Old_age Always - 175800438 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0 240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 85766201935254 241 Unknown_Attribute 0x0000 100 253 000 Old_age Offline - 3372984129 242 Unknown_Attribute 0x0000 100 253 000 Old_age Offline - 4260925014 SMART Error Log Version: 1 (-l error) No Errors Logged SMART Self-test log structure revision number 1 (-l selftest) No self-tests have been logged. [To run self-tests, use: smartctl -t] SMART Selective self-test log data structure revision number 1 (-l selective) SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS 1 0 0 Not_testing 2 0 0 Not_testing 3 0 0 Not_testing 4 0 0 Not_testing 5 0 0 Not_testing Selective self-test flags (0x0): After scanning selected spans, do NOT read-scan remainder of disk. If Selective self-test is pending on power-up, resume after 0 minute delay.

Memory test

memtest86, memtest86+ はブートイメージで、OSに依存せずチェック可能。
# memtester  1G
memtester version 4.2.0 (32-bit)
Copyright (C) 2010 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 1024MB (1073741824 bytes)
got  1024MB (1073741824 bytes), trying mlock ...locked.
Loop 1:
  Stuck Address       : ok
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok
  Block Sequential    : ok
  Checkerboard        : ok
  Bit Spread          : ok
  Bit Flip            : ok
  Walking Ones        : ok
  Walking Zeroes      : ok
  8-bit Writes        : ok
  16-bit Writes       : ok

XFS (7-17)

パッケージの導入 実行例

# yum install kmod-xfs xfsdump xfsprogs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kmod-xfs.i686 0:0.4-2 set to be installed
---> Package xfsdump.i386 0:2.2.46-1.el5.centos set to be updated
--> Processing Dependency: dmapi >= 2.0.0 for package: xfsdump
---> Package xfsprogs.i386 0:2.9.4-1.el5.centos set to be updated
--> Running transaction check
---> Package dmapi.i386 0:2.2.8-1.el5.centos set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch         Version                     Repository      Size
================================================================================
Installing:
 kmod-xfs         i686         0.4-2                       extras         261 k
 xfsdump          i386         2.2.46-1.el5.centos         extras         342 k
 xfsprogs         i386         2.9.4-1.el5.centos          extras         1.5 M
Installing for dependencies:
 dmapi            i386         2.2.8-1.el5.centos          extras          45 k

Transaction Summary
================================================================================
Install       4 Package(s)
Upgrade       0 Package(s)

Total download size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): dmapi-2.2.8-1.el5.centos.i386.rpm                 |  45 kB     00:00
(2/4): kmod-xfs-0.4-2.i686.rpm                           | 261 kB     00:00
(3/4): xfsdump-2.2.46-1.el5.centos.i386.rpm              | 342 kB     00:00
(4/4): xfsprogs-2.9.4-1.el5.centos.i386.rpm              | 1.5 MB     00:00
--------------------------------------------------------------------------------
Total                                           3.0 MB/s | 2.1 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : xfsprogs [############################################ ] 1/4
  Installing     : dmapi [############################################### ] 2/4

warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
			:
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
  Installing     : kmod-xfs [############################################ ] 3/4
  Installing     : xfsdump [############################################# ] 4/4

warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
			:
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root

Installed:
  kmod-xfs.i686 0:0.4-2                  xfsdump.i386 0:2.2.46-1.el5.centos    
  xfsprogs.i386 0:2.9.4-1.el5.centos    

Dependency Installed:
  dmapi.i386 0:2.2.8-1.el5.centos                                               

Complete!

XFS ファイルシステムの作成と拡張例 実行例
# mkfs.xfs -f /dev/vg01/lv01
meta-data=/dev/vg01/lv01         isize=256    agcount=8, agsize=5760 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=46080, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096  
log      =internal log           bsize=4096   blocks=1200, version=1
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
# mount /dev/vg01/lv01 /media/lvm
# df
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/sda6               988088    361180    575904  39% /
/dev/sda8               497829     36829    435298   8% /home
/dev/sda7               497829     10579    461548   3% /tmp
/dev/sda5               988088    124788    812296  14% /var
/dev/sda2              4956316   1977668   2722816  43% /usr
/dev/sda1               124427     22107     95896  19% /boot
tmpfs                   512540         0    512540   0% /dev/shm
/dev/mapper/vg01-lv01
                        179520       288    179232   1% /media/lvm
# mount
/dev/sda6 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda8 on /home type ext3 (rw)
/dev/sda7 on /tmp type ext3 (rw)
/dev/sda5 on /var type ext3 (rw)
/dev/sda2 on /usr type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/vg01-lv01 on /media/lvm type xfs (rw)

# vgcreate /dev/sda11
  Please enter a physical volume path
  Run `vgcreate --help' for more information.
# pvcreate /dev/sda11
  Writing physical volume data to disk "/dev/sda11"
  Physical volume "/dev/sda11" successfully created

# vgextend vg01 /dev/sda11
  Volume group "vg01" successfully extended

# vgs vg01
  VG   #PV #LV #SN Attr   VSize   VFree  
  vg01   3   1   0 wz--n- 300.00M 120.00M

# vgdisplay vg01

  --- Volume group ---
  VG Name               vg01
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               300.00 MB
  PE Size               4.00 MB
  Total PE              75
  Alloc PE / Size       45 / 180.00 MB
  Free  PE / Size       30 / 120.00 MB
  VG UUID               AB1nYd-6wU7-hPNr-4xTA-hl7w-i085-qPFarw
   
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree  
  vg01   3   1   0 wz--n- 300.00M 120.00M
# lvextend -L +60m /dev/vg01/lv01
  Extending logical volume lv01 to 240.00 MB
  Logical volume lv01 successfully resized
# df
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/sda6               988088    361188    575896  39% /
/dev/sda8               497829     36833    435294   8% /home
/dev/sda7               497829     10588    461539   3% /tmp
/dev/sda5               988088    124788    812296  14% /var
/dev/sda2              4956316   1977668   2722816  43% /usr
/dev/sda1               124427     22107     95896  19% /boot
tmpfs                   512540         0    512540   0% /dev/shm
/dev/mapper/vg01-lv01
                        179520       288    179232   1% /media/lvm
# xfs_growfs /media/lvm
meta-data=/dev/vg01/lv01         isize=256    agcount=8, agsize=5760 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=46080, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096  
log      =internal               bsize=4096   blocks=1200, version=1
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 46080 to 61440

# df /media/lvm
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/vg01-lv01
                        240960       384    240576   1% /media/lvm

XFS 用語解説
特徴ext4Btrfs
FSサイズ1 EiB16 EiB
ディレクトリ管理B+-treeB-tree
空きスペース管理Bitmap,Htree?
inode配置?Dynamic
ファイル配置ExtentExtent
B-tree : Balanced Tree , 2分木データ構造
ランダムアクセスに対し O(log n) の検索
B*-tree
BTの改良版。親子だけでなく、隣へのポインタも持つ。
B+-tree
BTの改良版。キーは範囲を表し、子としてデータも保持できる。
Bitmap (FSの)
ノード(ブロック)の空きを 1 bit で表現したデータの固まり。
Block allocation (ext2/ext3)