两个命令:hdparm和iozone参数解释

1.hdpram:

haochuang@computer9:~$ hdparm -h

hdparm - get/set hard disk parameters - version v9.37, by Mark Lord.

Usage:  hdparm  [options] [device ...]

Options:
 -a   Get/set fs readahead
 -A   Get/set the drive look-ahead flag (0/1)
 -b   Get/set bus state (0 == off, 1 == on, 2 == tristate)
 -B   Set Advanced Power Management setting (1-255)
 -c   Get/set IDE 32-bit IO setting
 -C   Check drive power mode status
 -d   Get/set using_dma flag
 -D   Enable/disable drive defect management
 -E   Set cd/dvd drive speed
 -f   Flush buffer cache for device on exit
 -F   Flush drive write cache
 -g   Display drive geometry
 -h   Display terse usage information
 -H   Read temperature from drive (Hitachi only)
 -i   Display drive identification
 -I   Detailed/current information directly from drive
 -k   Get/set keep_settings_over_reset flag (0/1)
 -K   Set drive keep_features_over_reset flag (0/1)
 -L   Set drive doorlock (0/1) (removable harddisks only)
 -m   Get/set multiple sector count
 -M   Get/set acoustic management (0-254, 128: quiet, 254: fast)
 -n   Get/set ignore-write-errors flag (0/1)
 -N   Get/set max visible number of sectors (HPA) (VERY DANGEROUS)
 -p   Set PIO mode on IDE interface chipset (0,1,2,3,4,...)
 -P   Set drive prefetch count
 -q   Change next setting quietly
 -Q   Get/set DMA queue_depth (if supported)
 -r   Get/set device readonly flag (DANGEROUS to set)
 -R   Obsolete
 -s   Set power-up in standby flag (0/1) (DANGEROUS)
 -S   Set standby (spindown) timeout
 -t   Perform device read timings
 -T   Perform cache read timings
 -u   Get/set unmaskirq flag (0/1)
 -U   Obsolete
 -v   Use defaults; same as -acdgkmur for IDE drives
 -V   Display program version and exit immediately
 -w   Perform device reset (DANGEROUS)
 -W   Get/set drive write-caching flag (0/1)
 -x   Obsolete
 -X   Set IDE xfer mode (DANGEROUS)
 -y   Put drive in standby mode
 -Y   Put drive to sleep
 -z   Re-read partition table
 -Z   Disable Seagate auto-powersaving mode
 --dco-freeze      Freeze/lock current device configuration until next power cycle
 --dco-identify    Read/dump device configuration identify data
 --dco-restore     Reset device configuration back to factory defaults
 --direct          Use O_DIRECT to bypass page cache for timings
 --drq-hsm-error   Crash system with a "stuck DRQ" error (VERY DANGEROUS)
 --fallocate       Create a file without writing data to disk
 --fibmap          Show device extents (and fragmentation) for a file
 --fwdownload            Download firmware file to drive (EXTREMELY DANGEROUS)
 --fwdownload-mode3      Download firmware using min-size segments (EXTREMELY DANGEROUS)
 --fwdownload-mode3-max  Download firmware using max-size segments (EXTREMELY DANGEROUS)
 --fwdownload-mode7      Download firmware using a single segment (EXTREMELY DANGEROUS)
 --idle-immediate  Idle drive immediately
 --idle-unload     Idle immediately and unload heads
 --Istdin          Read identify data from stdin as ASCII hex
 --Istdout         Write identify data to stdout as ASCII hex
 --make-bad-sector Deliberately corrupt a sector directly on the media (VERY DANGEROUS)
 --offset          use with -t, to begin timings at given offset (in GiB) from start of drive
 --prefer-ata12    Use 12-byte (instead of 16-byte) SAT commands when possible
 --read-sector     Read and dump (in hex) a sector directly from the media
 --security-help   Display help for ATA security commands
 --trim-sector-ranges        Tell SSD firmware to discard unneeded data sectors: lba:count ..
 --trim-sector-ranges-stdin  Same as above, but reads lba:count pairs from stdin
 --verbose         Display extra diagnostics from some commands
 --write-sector    Repair/overwrite a (possibly bad) sector directly on the media (VERY DANGEROUS)
--------------------------------------------------------------------
语  法:hdparm [-CfghiIqtTvyYZ][-a <快取分区>][-A <0或1>][-c <I/O模式>][-d <0或1>][-k <0或1>][-K <0或1>][-m <分区数>][-n <0或1>][-p <PIO模式>][-P <分区数>][-r <0或1>][-S <时间>][-u <0或1>][-W <0或1>][-X <传输模式>][设备]
补充说明:hdparm可检测,显示与设定IDE或SCSI硬盘的参数。
参  数:
  -a<快取分区>   设定读取文件时,预先存入块区的分区数,若不加上<快取分区>选项,则显示目前的设定。
  -A<0或1>   启动或关闭读取文件时的快取功能。
  -c<I/O模式>   设定IDE32位I/O模式。
  -C   检测IDE硬盘的电源管理模式。
  -d<0或1>   设定磁盘的DMA模式。
  -f   将内存缓冲区的数据写入硬盘,并清楚缓冲区。
  -g   显示硬盘的磁轨,磁头,磁区等参数。
  -h   显示帮助。
  -i   显示硬盘的硬件规格信息,这些信息是在开机时由硬盘本身所提供。
  -I   直接读取硬盘所提供的硬件规格信息。
  -k<0或1>   重设硬盘时,保留-dmu参数的设定。
  -K<0或1>   重设硬盘时,保留-APSWXZ参数的设定。
  -m<磁区数>   设定硬盘多重分区存取的分区数。
  -n<0或1>   忽略硬盘写入时所发生的错误。
  -p<PIO模式>   设定硬盘的PIO模式。
  -P<磁区数>   设定硬盘内部快取的分区数。
  -q   在执行后续的参数时,不在屏幕上显示任何信息。
  -r<0或1>   设定硬盘的读写模式。
  -S<时间>   设定硬盘进入省电模式前的等待时间。
  -t   评估硬盘的读取效率。
  -T  评估硬盘快取的读取效率。
  -u<0或1>   在硬盘存取时,允许其他中断要求同时执行。
  -v   显示硬盘的相关设定。
  -W<0或1>   设定硬盘的写入快取。
  -X<传输模式>   设定硬盘的传输模式。
  -y   使IDE硬盘进入省电模式。
  -Y   使IDE硬盘进入睡眠模式。
  -Z   关闭某些Seagate硬盘的自动省电功能。

测试硬盘的读取速度:
普通磁盘测试:
# hdparm -t /dev/sda
/dev/sda:
 Timing buffered disk reads:  316 MB in  3.02 seconds = 104.71 MB/sec

# hdparm -T /dev/sda
/dev/sda:
 Timing cached reads:   19328 MB in  1.99 seconds = 9691.24 MB/sec

RAID0测试(两块盘):
# hdparm -t /dev/sdb
/dev/sdb:
 Timing buffered disk reads:  622 MB in  3.01 seconds = 206.89 MB/sec
 
# hdparm -T /dev/sdb1
/dev/sdb1:
 Timing cached reads:   19632 MB in  1.99 seconds = 9844.20 MB/sec

RAID0测试(三块盘):
# hdparm -t /dev/sdb
/dev/sdb:
 Timing buffered disk reads:  846 MB in  3.00 seconds = 281.54 MB/sec
 
 
# hdparm -T /dev/sdb
/dev/sdb:
 Timing cached reads:   18412 MB in  1.99 seconds = 9229.67 MB/sec

RAID0测试(四块盘)
/dev/sdb:
 Timing cached reads:   19608 MB in  1.99 seconds = 9832.76 MB/sec
 
 Timing buffered disk reads:  860 MB in  3.00 seconds = 286.35 MB/sec

另外ARID卡测试速度后,每次会警告:
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device

参考测试速度方法:time cp -a data2 data2

原文:http://blog.sina.com.cn/s/blog_60359c5b0100gjvw.html
--------------------------------------------------------------------
2.iozone:
 haochuang@computer9:~$ iozone -h
iozone: help mode

    Usage: iozone [-s filesize_Kb] [-r record_size_Kb] [-f [path]filename] [-h]
                  [-i test] [-E] [-p] [-a] [-A] [-z] [-Z] [-m] [-M] [-t children]
                  [-l min_number_procs] [-u max_number_procs] [-v] [-R] [-x] [-o]
                  [-d microseconds] [-F path1 path2...] [-V pattern] [-j stride]
                  [-T] [-C] [-B] [-D] [-G] [-I] [-H depth] [-k depth] [-U mount_point]
                  [-S cache_size] [-O] [-L cacheline_size] [-K] [-g maxfilesize_Kb]
                  [-n minfilesize_Kb] [-N] [-Q] [-P start_cpu] [-e] [-c] [-b Excel.xls]
                  [-J milliseconds] [-X write_telemetry_filename] [-w] [-W]
                  [-Y read_telemetry_filename] [-y minrecsize_Kb] [-q maxrecsize_Kb]
                  [-+u] [-+m cluster_filename] [-+d] [-+x multiplier] [-+p # ]
                  [-+r] [-+t] [-+X] [-+Z] [-+w percent dedupable] [-+y percent_interior_dedup]
                  [-+C percent_dedup_within]
 
           -a  Auto mode
           -A  Auto2 mode
           -b Filename  Create Excel worksheet file
           -B  Use mmap() files
           -c  Include close in the timing calculations
           -C  Show bytes transferred by each child in throughput testing
           -d #  Microsecond delay out of barrier
           -D  Use msync(MS_ASYNC) on mmap files
           -e  Include flush (fsync,fflush) in the timing calculations
           -E  Run extension tests
           -f filename  to use
           -F filenames  for each process/thread in throughput test
           -g #  Set maximum file size (in Kbytes) for auto mode (or #m or #g)
           -G  Use msync(MS_SYNC) on mmap files
           -h  help
           -H #  Use POSIX async I/O with # async operations
           -i #  Test to run (0=write/rewrite, 1=read/re-read, 2=random-read/write
                 3=Read-backwards, 4=Re-write-record, 5=stride-read, 6=fwrite/re-fwrite
                 7=fread/Re-fread, 8=random_mix, 9=pwrite/Re-pwrite, 10=pread/Re-pread
                 11=pwritev/Re-pwritev, 12=preadv/Re-preadv)
           -I  Use VxFS VX_DIRECT, O_DIRECT,or O_DIRECTIO for all file operations
           -j #  Set stride of file accesses to (# * record size)
           -J #  milliseconds of compute cycle before each I/O operation
           -k #  Use POSIX async I/O (no bcopy) with # async operations
           -K  Create jitter in the access pattern for readers
           -l #  Lower limit on number of processes to run
           -L #  Set processor cache line size to value (in bytes)
           -m  Use multiple buffers
           -M  Report uname -a output
           -n #  Set minimum file size (in Kbytes) for auto mode (or #m or #g)
           -N  Report results in microseconds per operation
           -o  Writes are synch (O_SYNC)
           -O  Give results in ops/sec.
           -p  Purge on
           -P #  Bind processes/threads to processors, starting with this cpu
           -q #  Set maximum record size (in Kbytes) for auto mode (or #m or #g)
           -Q  Create offset/latency files
           -r #  record size in Kb
              or -r #k .. size in Kb
              or -r #m .. size in Mb
              or -r #g .. size in Gb
           -R  Generate Excel report
           -s #  file size in Kb
              or -s #k .. size in Kb
              or -s #m .. size in Mb
              or -s #g .. size in Gb
           -S #  Set processor cache size to value (in Kbytes)
           -t #  Number of threads or processes to use in throughput test
           -T  Use POSIX pthreads for throughput tests
           -u #  Upper limit on number of processes to run
           -U  Mount point to remount between tests
           -v  version information
           -V #  Verify data pattern write/read
           -w  Do not unlink temporary file
           -W  Lock file when reading or writing
           -x  Turn off stone-walling
           -X filename  Write telemetry file. Contains lines with (offset reclen compute_time) in ascii
           -y #  Set minimum record size (in Kbytes) for auto mode (or #m or #g)
           -Y filename  Read  telemetry file. Contains lines with (offset reclen compute_time) in ascii
           -z  Used in conjunction with -a to test all possible record sizes
           -Z  Enable mixing of mmap I/O and file I/O
           -+E Use existing non-Iozone file for read-only testing
           -+K Sony special. Manual control of test 8.
           -+m  Cluster_filename   Enable Cluster testing
           -+d  File I/O diagnostic mode. (To troubleshoot a broken file I/O subsystem)
           -+u  Enable CPU utilization output (Experimental)
           -+x # Multiplier to use for incrementing file and record sizes
           -+p # Percentage of mix to be reads
           -+r Enable O_RSYNC|O_SYNC for all testing.
           -+t Enable network performance test. Requires -+m
           -+n No retests selected.
           -+k Use constant aggregate data set size.
           -+q Delay in seconds between tests.
           -+l Enable record locking mode.
           -+L Enable record locking mode, with shared file.
           -+B Sequential mixed workload.
           -+D Enable O_DSYNC mode.
           -+A #  Enable madvise. 0 = normal, 1=random, 2=sequential
                                  3=dontneed, 4=willneed
           -+N Do not truncate existing files on sequential writes.
           -+S # Dedup-able data is limited to sharing within each numerically
                 identified file set
           -+V Enable shared file. No locking.
           -+X Enable short circuit mode for filesystem testing ONLY
               ALL Results are NOT valid in this mode.
           -+Z Enable old data set compatibility mode. WARNING.. Published
               hacks may invalidate these results and generate bogus, high
               values for results.
           -+w ## Percent of dedup-able data in buffers.
           -+y ## Percent of dedup-able within & across files in buffers.
           -+C ## Percent of dedup-able within & not across files in buffers.
           -+H Hostname    Hostname of the PIT server.
           -+P Service     Service  of the PIT server.
           -+z Enable latency histogram logging.

赠人玫瑰
手留余香

我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生

如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的推荐按钮。
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的关注我

原文地址:https://www.cnblogs.com/haochuang/p/2289072.html