Linux下如何查看你的disk的信息

来源:互联网 发布:淘宝卖飞机 编辑:程序博客网 时间:2024/06/10 11:55

可以使用smartctl来查看你的disk的信息;
smartctl的disk路径和名字可以通过命令cat /proc/partitions 来得到。

sudo smartctl -d ata -a /dev/sda           smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-327.36.3.el7.x86_64] (local build)Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF INFORMATION SECTION ===Device Model:     MTFDDAK512MBF-xxSerial Number:    xxxLU WWN Device Id: xxxFirmware Version: xxxUser Capacity:    512,110,190,592 bytes [512 GB]Sector Size:      512 bytes logical/physicalRotation Rate:    Solid State DeviceDevice is:        Not in smartctl database [for details use: -P showall]ATA Version is:   ACS-3 (unknown minor revision code: 0x011b)SATA Version is:  SATA >3.1, 6.0 Gb/s (current: 6.0 Gb/s)Local Time is:    Wed Dec  6 10:22:40 2017 CSTSMART support is: Available - device has SMART capability.SMART support is: Enabled...

从Device Model中,可以知道,我的硬盘是MTFDDAK512MBF,在网址google一下,就知道它是Micron产的,具体的内容为了安全考虑,我就不贴出来了。

smartctl中的type的解释:
ATA, SCSI command sets and SAT

In the past there has been a clear distinction between storage devices that used the ATA and SCSI command sets. This distinction was often reflected in their device naming and hardware. Now various SCSI transports (e.g. SAS, FC and iSCSI) can interconnect to both SCSI disks (e.g. FC and SAS) and ATA disks (especially SATA). USB and IEEE 1394 storage devices use the SCSI command set externally but almost always contain ATA or SATA disks (or flash). The storage subsystems in some operating systems have started to remove the distinction between ATA and SCSI in their device naming policies.

99% of operations that an OS performs on a disk involve the SCSI INQUIRY, READ CAPACITY, READ and WRITE commands, or their ATA equivalents. Since the SCSI commands are slightly more general than their ATA equivalents, many OSes are generating SCSI commands (mainly READ and WRITE) and letting a lower level translate them to their ATA equivalents as the need arises. An important note here is that “lower level” may be in external equipment and hence outside the control of an OS.

SCSI to ATA Translation (SAT) is a standard (ANSI INCITS 431-2007) that specifies how this translation is done. For the other 1% of operations that an OS performs on a disk, SAT provides two options. First is an optional ATA PASS-THROUGH SCSI command (there are two variants). The second is a translation from the closest SCSI command. Most current interest is in the “pass-through” option.

The relevance to smartmontools (and hence smartctl) is that its interactions with disks fall solidly into the “1%” category. So even if the OS can happily treat (and name) a disk as “SCSI”, smartmontools needs to detect the native command set and act accordingly. As more storage manufacturers (including external SATA drives) comply with SAT, smartmontools is able to automatically distinguish the native command set of the device. In some cases the ‘-d sat’ option is needed on the command line.

There are also virtual disks which typically have no useful information to convey to smartmontools, but could conceivably in the future. An example of a virtual disk is the OS’s view of a RAID 1 box. There are most likely two SATA disks inside a RAID 1 box. Addressing those SATA disks from a distant OS is a challenge for smartmontools. Another approach is running a tool like smartmontools inside the RAID 1 box (e.g. a Network Attached Storage (NAS) box) and fetching the logs via a browser.

ref: https://linux.die.net/man/8/smartctl
http://www.tutorialspoint.com/unix_commands/smartctl.htm

原创粉丝点击