2017年9月24日日曜日

中古SSDの初期確認

某ショップから、中古で SanDisk 製 SSD を入手しました。その初期確認結果、備忘録です。

まず、Win7 環境から定番ソフトで確認した結果です。

中古ということで、どのくらい消耗しているのかが気がかりでしたが、SanDisk SSD Dashboard で「余寿命」が 100% でした。入手価格からすれば、よい買い物であったように感じます。

次は、CentOS6 環境で採取した smartctl -a の結果です。
smartctl 5.43 2016-09-28 r4347 [x86_64-linux-2.6.32-696.10.1.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Marvell based SanDisk SSDs
Device Model:     SanDisk SDSSDXPS240G
Serial Number:    xxxxxxxxx143
LU WWN Device Id: 5 001b44 yyyyyyyyy
Firmware Version: X21100RL
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ACS-2 revision 3
Local Time is:    Sat Sep 23 18:53:25 2017 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
     was never started.
     Auto Offline Data Collection: Disabled.
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:   (    0) seconds.
Offline data collection
capabilities:     (0x11) SMART execute Offline immediate.
     No Auto Offline data collection support.
     Suspend Offline collection upon new
     command.
     No Offline surface scan supported.
     Self-test supported.
     No Conveyance Self-test supported.
     No 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:   (   2) minutes.
Extended self-test routine
recommended polling time:   (  10) minutes.

SMART Attributes Data Structure revision number: 4
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0032   100   100   ---    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   253   100   ---    Old_age   Always       -       707
 12 Power_Cycle_Count       0x0032   100   100   ---    Old_age   Always       -       421
166 Min_W/E_Cycle           0x0032   100   100   ---    Old_age   Always       -       1
167 Min_Bad_Block/Die       0x0032   100   100   ---    Old_age   Always       -       45
168 Maximum_Erase_Cycle     0x0032   100   100   ---    Old_age   Always       -       45
169 Total_Bad_Block         0x0032   100   100   ---    Old_age   Always       -       606
171 Program_Fail_Count      0x0032   100   100   ---    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   ---    Old_age   Always       -       0
173 Avg_Write/Erase_Count   0x0032   100   100   ---    Old_age   Always       -       14
174 Unexpect_Power_Loss_Ct  0x0032   100   100   ---    Old_age   Always       -       76
184 End-to-End_Error        0x0032   100   100   ---    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   ---    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   ---    Old_age   Always       -       3
194 Temperature_Celsius     0x0022   070   046   ---    Old_age   Always       -       30 (Min/Max 16/46)
199 SATA_CRC_Error          0x0032   100   100   ---    Old_age   Always       -       0
212 SATA_PHY_Error          0x0032   100   100   ---    Old_age   Always       -       0
230 Perc_Write/Erase_Count  0x0032   100   100   ---    Old_age   Always       -       46
232 Perc_Avail_Resrvd_Space 0x0033   100   100   004    Pre-fail  Always       -       100
233 Total_NAND_Writes_GiB   0x0032   100   100   ---    Old_age   Always       -       3815
241 Total_Writes_GiB        0x0030   253   253   ---    Old_age   Offline      -       2895
242 Total_Reads_GiB         0x0030   253   253   ---    Old_age   Offline      -       4817
244 Thermal_Throttle        0x0032   000   100   ---    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]


Device does not support Selective Self Tests/Logging
次は、hdparm -I の結果です。
ATA device, with non-removable media
        Model Number:       SanDisk SDSSDXPS240G                    
        Serial Number:      xxxxxxxxx143        
        Firmware Revision:  X21100RL
        Media Serial Num:   
        Media Manufacturer: 
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Used: unknown (minor revision code 0x0110) 
        Supported: 9 8 7 6 5 
        Likely used: 9
Configuration:
        Logical         max     current
        cylinders       16383   65535
        heads           16      1
        sectors/track   63      63
        --
        CHS current addressable sectors:    4128705
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors:  468862128
        Logical  Sector size:                   512 bytes
        Physical Sector size:                   512 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:      228936 MBytes
        device size with M = 1000*1000:      240057 MBytes (240 GB)
        cache/buffer size  = unknown
        Form Factor: 2.5 inch
        Nominal Media Rotation Rate: Solid State Device
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 1   Current = 1
        Advanced power management level: 128
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
           *    Advanced Power Management feature set
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    WRITE_{DMA|MULTIPLE}_FUA_EXT
           *    64-bit World wide name
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Host-initiated interface power management
           *    Phy event counters
           *    unknown 76[15]
           *    DMA Setup Auto-Activate optimization
           *    Device-initiated interface power management
           *    Software settings preservation
                unknown 78[8]
           *    Data Set Management TRIM supported (limit 16 blocks)
           *    Deterministic read ZEROs after TRIM
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
                frozen
        not     expired: security count
                supported: enhanced erase
        2min for SECURITY ERASE UNIT. 18min for ENHANCED SECURITY ERASE UNIT. 
Logical Unit WWN Device Identifier: 5001b44yyyyyyyyy
        NAA             : 5
        IEEE OUI        : 001b44
        Unique ID       : yyyyyyyyy
Checksum: correct
次は、diskutility での読み込みベンチマーク結果です。

おそらくですが、全領域ゼロ書き込みした状態と思われるので、SecureErase を行いました。
次は、SecureErase 後の diskutility ベンチマークの結果です。ちょっとだけ数値がアップしています。

なお、思わず盲目的に SecureErase をやってしまいましたが、blkdiscard で十分だったかもしれません。

2017年9月18日月曜日

何日前に作成されたファイルか調べる方法

ときどきですが、何日前に作成されたファイルなのかを、知りたい場合があります。
正確に知る必要がなければ、頭の中でだいたいの計算をしたりしますが、bashとdateコマンドで次のようにして計算できるようです。備忘録。
[root@hoge ~]# ls -l anaconda-ks.cfg
-rw-------. 1 root root 1125 May  2  2015 anaconda-ks.cfg
[root@hoge ~]# declare -i d_diff=($(date -d now +%s)-$(date -r ./anaconda-ks.cfg +%s))/24/3600
[root@hoge ~]# echo $d_diff
870
[root@hoge ~]#

2017年8月18日金曜日

ThinkPad W520 + CentOS 7 夏対策(省電力設定)

このところ、firefox でブラウズしているだけでも、冷却ファンが回り続けてしまい耳障りなので、夏対策を少々。
定番的なものだけですが、備忘録です。

まず、NVIDIA のドライバを nouveau から kmod-nvidia に変更しました(elrepo 利用)。最近は安定していて、それほど不満ないので、nouveau を使ってましたが、おそらくは NVIDIA 謹製ドライバでないと、省電力制御が働かないのではと思ったので。
[root@hoge ~]# yum list kmod-nvidia --enablerepo=elrepo --showduplicates
読み込んだプラグイン:fastestmirror, langpacks, nvidia
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * elrepo: elrepo.org
 * extras: download.nus.edu.sg
 * updates: download.nus.edu.sg
利用可能なパッケージ
kmod-nvidia.x86_64                 367.57-1.el7.elrepo                   elrepo 
kmod-nvidia.x86_64                 367.57-2.el7.elrepo                   elrepo 
kmod-nvidia.x86_64                 367.57-3.el7.elrepo                   elrepo 
kmod-nvidia.x86_64                 375.66-1.el7.elrepo                   elrepo 
kmod-nvidia.x86_64                 384.59-1.el7.elrepo                   elrepo ※こっちを利用
kmod-nvidia.x86_64                 384.59-2.el7_4.elrepo                 elrepo 
※↑あいにく RHEL7.4 カーネル向けが出ていて、まだ CentOS 7.4 が出てないので、こっちは NG (シンボルエラーになる)
[root@hoge ~]# yum install kmod-nvidia-384.59-1.el7.elrepo.x86_64 --enablerepo=elrepo
...
あとは、CPU と SSD の省電力設定を行いました。
[root@hoge ~]# cpupower frequency-set -g powersave
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
[root@hoge ~]# find /sys/ | grep link_power
/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/scsi_host/host0/link_power_management_policy
/sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/scsi_host/host1/link_power_management_policy
/sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/scsi_host/host2/link_power_management_policy
/sys/devices/pci0000:00/0000:00:1f.2/ata4/host3/scsi_host/host3/link_power_management_policy
/sys/devices/pci0000:00/0000:00:1f.2/ata5/host4/scsi_host/host4/link_power_management_policy
/sys/devices/pci0000:00/0000:00:1f.2/ata6/host5/scsi_host/host5/link_power_management_policy
[root@hoge ~]# lsdisk
DEVICE   Driver        PCI           Description
================================================================================
scsi0    ahci          00:1f.2       +
  sda    sd                 .        scsi0 ch=0 id=0 lun=0  size=240.0GB
scsi1    ahci          00:1f.2       +
  sdb    sd                 .        scsi1 ch=0 id=0 lun=0  size=240.0GB
scsi2    ahci          00:1f.2       +
scsi3    ahci          00:1f.2       +
scsi4    ahci          00:1f.2       +
scsi5    ahci          00:1f.2       +

[root@hoge ~]# echo min_power > /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/scsi_host/host0/link_power_management_policy
[root@hoge ~]# echo min_power > /sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/scsi_host/host1/link_power_management_policy
... 約10分後 ...
[root@hoge ~]# hddtemp 
/dev/sda: INTEL SSDSC2BW240A4: 40°C  ※だいたい、マイナス2度ほど下がりました
/dev/sdb: INTEL SSDSC2BW240A4: 35°C  ※だいたい、マイナス2度ほど下がりました
[root@hoge ~]# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +57.0°C  (crit = +99.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        2532 RPM  ※この回転数だと、それほど耳障りではなかったです

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +57.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +57.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +54.0°C  (high = +86.0°C, crit = +100.0°C)
Core 2:         +53.0°C  (high = +86.0°C, crit = +100.0°C)
Core 3:         +54.0°C  (high = +86.0°C, crit = +100.0°C)
これらの対策により、冷却ファンは鎮まりました。こうやって、マニュアル操作でいじくれるのが Linux のよいところですね。
人気ブログランキングへ にほんブログ村 IT技術ブログへ