Archive for 4月, 2015

linux 查看磁盘信息

 

linaro@cubieboard:~$ sudo aptitude install smartmontools
linaro@cubieboard:~$ sudo smartctl -a /dev/sda
smartctl 6.2 2013-07-26 r3841 [armv7l-linux-3.4.79] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.10
Device Model:     ST3160815AS
Serial Number:    6RA0H0PJ
Firmware Version: 3.AAC
User Capacity:    160,041,885,696 bytes [160 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-7 (minor revision not indicated)
Local Time is:    Tue Apr 28 10:24:05 2015 UTC
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
See vendor-specific Attribute list for marginal Attributes.

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:                (  430) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No 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:        (  54) minutes.

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   112   095   006    Pre-fail  Always       -       42480436
  3 Spin_Up_Time            0x0003   098   097   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   094   094   020    Old_age   Always       -       6735
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   089   060   030    Pre-fail  Always       -       833016196
  9 Power_On_Hours          0x0032   067   067   000    Old_age   Always       -       28938
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   094   094   020    Old_age   Always       -       6263
187 Reported_Uncorrect      0x0032   082   082   000    Old_age   Always       -       18
189 High_Fly_Writes         0x003a   094   094   000    Old_age   Always       -       6
190 Airflow_Temperature_Cel 0x0022   044   039   045    Old_age   Always   FAILING_NOW 56 (Min/Max 53/57)
194 Temperature_Celsius     0x0022   056   061   000    Old_age   Always       -       56 (0 2 0 0 0)
195 Hardware_ECC_Recovered  0x001a   072   060   000    Old_age   Always       -       170581721
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       1
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       1
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline      -       0
202 Data_Address_Mark_Errs  0x0032   100   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
ATA Error Count: 18 (device log contains only the most recent five errors)
        CR = Command Register [HEX]
        FR = Features Register [HEX]
        SC = Sector Count Register [HEX]
        SN = Sector Number Register [HEX]
        CL = Cylinder Low Register [HEX]
        CH = Cylinder High Register [HEX]
        DH = Device/Head Register [HEX]
        DC = Device Command Register [HEX]
        ER = Error register [HEX]
        ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 18 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 96 a5 6d e0  Error: UNC at LBA = 0x006da596 = 7185814

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 8f a5 6d e0 00      00:01:07.094  READ DMA EXT
  25 00 08 87 a5 6d e0 00      00:01:07.094  READ DMA EXT
  25 00 08 7f a5 6d e0 00      00:01:07.094  READ DMA EXT
  25 00 08 77 a5 6d e0 00      00:01:07.088  READ DMA EXT
  25 00 08 6f a5 6d e0 00      00:01:07.088  READ DMA EXT

Error 17 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 96 a5 6d e0  Error: UNC at LBA = 0x006da596 = 7185814

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 68 4f a5 6d e0 00      00:01:03.681  READ DMA EXT
  25 00 00 37 9d 6b e0 00      00:01:03.679  READ DMA EXT
  25 00 00 37 9c 6b e0 00      00:01:03.677  READ DMA EXT
  25 00 00 b7 9a 6b e0 00      00:01:03.669  READ DMA EXT
  25 00 00 b7 99 6b e0 00      00:01:03.669  READ DMA EXT

Error 16 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 96 a5 6d e0  Error: UNC at LBA = 0x006da596 = 7185814

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 8f a5 6d e0 00      00:20:34.997  READ DMA EXT
  25 00 08 87 a5 6d e0 00      00:20:34.997  READ DMA EXT
  25 00 08 7f a5 6d e0 00      00:20:34.997  READ DMA EXT
  25 00 08 77 a5 6d e0 00      00:20:34.997  READ DMA EXT
  25 00 08 6f a5 6d e0 00      00:20:34.996  READ DMA EXT

Error 15 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 96 a5 6d e0  Error: UNC at LBA = 0x006da596 = 7185814

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 68 4f a5 6d e0 00      00:20:31.667  READ DMA EXT
  25 00 00 37 9d 6b e0 00      00:20:31.657  READ DMA EXT
  25 00 00 37 9c 6b e0 00      00:20:31.654  READ DMA EXT
  25 00 00 b7 9a 6b e0 00      00:20:31.643  READ DMA EXT
  25 00 00 b7 99 6b e0 00      00:20:31.641  READ DMA EXT

Error 14 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 96 a5 6d e0  Error: UNC at LBA = 0x006da596 = 7185814

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 8f a5 6d e0 00      00:09:29.947  READ DMA EXT
  25 00 08 87 a5 6d e0 00      00:09:29.947  READ DMA EXT
  25 00 08 7f a5 6d e0 00      00:09:29.947  READ DMA EXT
  25 00 08 77 a5 6d e0 00      00:09:29.947  READ DMA EXT
  25 00 08 6f a5 6d e0 00      00:09:29.946  READ DMA EXT

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     14609         -
# 2  Short offline       Aborted by host               90%     14609         -
# 3  Short offline       Completed without error       00%     14380         -

SMART Selective self-test log data structure revision number 1
 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.

linaro@cubieboard:~$ sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
        Model Number:       ST3160815AS
        Serial Number:      6RA0H0PJ
        Firmware Revision:  3.AAC
Standards:
        Supported: 7 6 5 4
        Likely used: 7
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors:  312581808
        Logical  Sector size:                   512 bytes
        Physical Sector size:                   512 bytes
        device size with M = 1024*1024:      152627 MBytes
        device size with M = 1000*1000:      160041 MBytes (160 GB)
        cache/buffer size  = 8192 KBytes
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 = 16  Current = ?
        Recommended acoustic management value: 208, current value: 0
        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
                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
           *    Gen1 signaling speed (1.5Gb/s)
           *    Native Command Queueing (NCQ)
           *    Phy event counters
                Device-initiated interface power management
           *    Software settings preservation
Security:
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
        not     supported: enhanced erase
Checksum: correct
linaro@cubieboard:~$ sudo smartctl -H /dev/sda
smartctl 6.2 2013-07-26 r3841 [armv7l-linux-3.4.79] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022   043   039   045    Old_age   Always   FAILING_NOW 57 (0 2 57 53 0)


检测磁盘驱动的健康程度SMART
http://www.linuxidc.com/Linux/2014-07/104674.htm

No comment »

cubieboard NAS samba 配置

接着上一篇继续

cubieboard 磁盘性能

安装 samba ,这里先安装 aptitude 。第一次时是用 apt-get 来安装的 samba ,结果出现包依赖错误,系统都挂了…

 
linaro@cubieboard:~$ sudo apt-get install aptitude
slinaro@cubieboard:~$ sudo aptitude update
linaro@cubieboard:~$ sudo aptitude safe-upgrade
linaro@cubieboard:~$ sudo aptitude install samba

下面配置账号。

 
linaro@cubieboard:~$ sudo adduser gftp
Adding user `gftp' ...
Adding new group `gftp' (1002) ...
Adding new user `gftp' (1001) with group `gftp' ...
Creating home directory `/home/gftp' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for gftp
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n]
linaro@cubieboard:~$ sudo usermod -a -G gftp linaro
linaro@cubieboard:/mnt/100g$ sudo chown gftp:gftp /mnt/100g
linaro@cubieboard:/mnt/100g$ sudo chmod ug+w /mnt/100g
linaro@cubieboard:~$ sudo smbpasswd -a gftp
New SMB password:
Retype new SMB password:
Added user gftp.
linaro@cubieboard:~$ sudo vi /etc/samba/smb.conf
# 追加以下内容:
[gftp_100g]
path = /mnt/100g
available = yes
valid users = gftp
read only = no
browseable = yes
public = yes
writable = yes


linaro@cubieboard:~$ sudo service smbd restart
smbd stop/waiting
smbd start/running, process 24739

好了,现在可以在 windows 下使用 \\IP 来访问共享了。
实测 win7 往 cubieboard 拷贝大文件速度在 9.77M -10.1M之间,应该是cubieboard 100M网卡的性能限制的。

参考:
How to Create a Network Share Via Samba Via CLI (Command-line interface/Linux Terminal) – Uncomplicated, Simple and Brief Way!
https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!

No comment »

cubieboard 磁盘性能

今天把很早之前的 cubieboard 翻了出来,打算做 nas 。缺点是网卡是100M的。

现在的tf安装的 linaro server 14.04 系统。

tf卡是:三星(SAMSUNG)16GB UHS-1 Class10 TF(Micro SD)存储卡(读速48Mb/s)升级版
http://item.jd.com/763749.html

tf 卡速度为:

 
linaro@cubieboard:~$ sudo time dd if=/dev/zero bs=1024 count=1000000 of=/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 106.254 s, 9.6 MB/s
0.83user 20.45system 1:46.26elapsed 20%CPU (0avgtext+0avgdata 640maxresident)k
8inputs+2000000outputs (1major+208minor)pagefaults 0swaps
linaro@cubieboard:~$ time dd if=/1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 66.1161 s, 15.5 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 66.1271 s, 15.5 MB/s

real    1m6.146s
user    0m2.350s
sys     0m17.540s

找了一块古董100g硬盘来做测试。

 
linaro@cubieboard:~$ sudo fdisk -l
....
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe467e467

   Device Boot      Start         End      Blocks   Id  System

....

fdisk 列出硬盘分区,硬盘的分区已经预先删干净了,下面新建一个主分区,并建立文件系统。

 
linaro@cubieboard:~$ sudo fdisk /dev/sda
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-312581807, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-312581807, default 312581807): +1G

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 2):
Using default value 2
First sector (2099200-312581807, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-312581807, default 312581807):
Using default value 312581807
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): p

Disk /dev/sda: 160.0 GB, 160041885696 bytes
81 heads, 63 sectors/track, 61254 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe467e467

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     2099199     1048576   82  Linux swap / Solaris
/dev/sda2         2099200   312581807   155241304   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
linaro@cubieboard:~$ sudo mkswap /dev/sda1
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=d1ba1e55-5eac-4226-9a2d-cda6eec6a84e
linaro@cubieboard:~$ sudo mkfs.ext4 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
9773056 inodes, 39072470 blocks
1953623 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1193 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information:
done

建立目录,挂载分区。

 
linaro@cubieboard:~$ sudo mkdir /mnt/100g
linaro@cubieboard:/mnt/100g$ cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
tmpfs            /tmp           tmpfs    size=20m                0       0
/dev/sda1        none           swap     defaults                0       0
/dev/sda2        /mnt/100g      ext4     defaults,noatime        0       2
linaro@cubieboard:~$ sudo swapon /dev/sda1
linaro@cubieboard:~$ sudo mount -a
linaro@cubieboard:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.3G  1.5G  5.6G  21% /
devtmpfs        493M  4.0K  493M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
tmpfs            20M     0   20M   0% /tmp
none             99M  244K   99M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            493M     0  493M   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/sda2       147G  188M  140G   1% /mnt/100g

跑磁盘性能测试

 
linaro@cubieboard:/mnt/100g$ sudo time dd if=/dev/zero bs=1024 count=1000000 of=/mnt/100g/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 52.1182 s, 19.6 MB/s
0.85user 20.33system 0:52.13elapsed 40%CPU (0avgtext+0avgdata 640maxresident)k
8inputs+2000056outputs (0major+217minor)pagefaults 0swaps
linaro@cubieboard:/mnt/100g$ time dd if=/mnt/100g/1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 39.456 s, 26.0 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 39.469 s, 25.9 MB/s

real    0m39.494s
user    0m2.220s
sys     0m20.660s
linaro@cubieboard:/mnt/100g$

性能并不好,不过由于网卡只有100M,NAS 瓶颈并不在磁盘,而是在网络…

参考:

linux测试硬盘读写速度
http://5iwww.blog.51cto.com/856039/432290

cubieboard的sata评测
http://raspiweb.ch/post-56.htm

No comment »