LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   SLOW DISK: 100MB/s read but only 2MB/s write! (https://www.linuxquestions.org/questions/linux-general-1/slow-disk-100mb-s-read-but-only-2mb-s-write-4175506008/)

MisterBark 05-24-2014 09:56 PM

SLOW DISK: 100MB/s read but only 2MB/s write!
 
Hi!

I just setup a new server, good machine, and I experience a very slow write speed on the disk although the read is fine.

Below are all details.
THANK YOU!

Custom Kernel 3.14.4-grsec 32bit - Xeon (core-avx2)
XFS file systems.

DISK:
WDC WD1003FBYX-0

CONTROLLER:

Intel 8 Series/C220 Series Chipset Family 4-port SATA Controller 1 [IDE mode]

Code:

# hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:  22962 MB in  1.99 seconds = 11514.06 MB/sec
 Timing buffered disk reads: 242 MB in  3.01 seconds =  80.49 MB/sec

Code:

# iotop WHILE READING: (copy big file from disk to ramfs)
Total DISK READ :      99.82 M/s | Total DISK WRITE :      2.27 M/s
Actual DISK READ:      99.82 M/s | Actual DISK WRITE:    1744.35 K/s

Code:

# iotop WHILE WRITING: (copy big file from ramfs to disk)
Total DISK READ :    711.29 K/s | Total DISK WRITE :      3.03 M/s
Actual DISK READ:    711.29 K/s | Actual DISK WRITE:      2.47 M/s

Code:

root[www]# hdparm -i /dev/sda

/dev/sda:

 Model=WDC WD1003FBYX-01Y7B0, FwRev=01.01V01, SerialNo=WD-WCAW30617487
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode


Emerson 05-24-2014 11:36 PM

Forget IDE mode. Go AHCI.

MisterBark 05-25-2014 07:16 AM

Thank you but I'm sorry, I don't see how that could make the disk that slow in writing only!

Emerson 05-25-2014 12:45 PM

You may also have misaligned partitions.

MisterBark 05-25-2014 01:05 PM

Right, I thought about that, but would the read speed still be so fast? (100MB/s)

rknichols 05-25-2014 05:42 PM

Quote:

Originally Posted by MisterBark (Post 5176834)
Right, I thought about that, but would the read speed still be so fast? (100MB/s)

Yes. Misalignment has negligible effect on read performance, but impacts write performance severely.

MisterBark 05-25-2014 11:36 PM

Ah. Thank you.

Any thought on that:
Code:

# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0xc8ecb330

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    25189919    12594928+  83  Linux
/dev/sda2        25189920    58765769    16787925  82  Linux swap
/dev/sda3        58765770  226548629    83891430  83  Linux
/dev/sda4      226548630  1953520064  863485717+  5  Extended
/dev/sda5      226548693  394331489    83891398+  83  Linux
/dev/sda6      394331553  1953520064  779594256  83  Linux


rknichols 05-26-2014 08:15 AM

Quote:

Originally Posted by MisterBark (Post 5176986)
Code:

Sector size (logical/physical): 512 bytes / 512 bytes

Alignment should not be an issue for that disk drive. Alignment is a concern only for drives with a 4K physical sector size.

Just to be sure the problem is really with the drive, turn off swap temporarily and try writing from /dev/zero to the swap partition.
Code:

swapoff /dev/sda2 && dd if=/dev/zero of=/dev/sda2 bs=1M seek=1 count=10K
swapon /dev/sda2

That "seek=1" leaves the swap header intact. Thus, no "mkswap" needed afterward.

MisterBark 05-26-2014 08:41 AM

Code:

# swapoff /dev/sda2 && dd if=/dev/zero of=/dev/sda2 bs=1M seek=1 count=10K
^C166+0 records in
166+0 records out
174063616 bytes (174 MB) copied, 289.139 s, 602 kB/s

Very interesting, thank you!
I had to stop it because it would take forever.

During that, I was monitoring with iotop and the overall write speed of the disk never went over 3MB/s, usually 1-2MB/s.

Emerson 05-26-2014 03:09 PM

Quote:

Sector size (logical/physical): 512 bytes / 512 bytes
Drive can present incorrect physical sector size and I'm pretty sure it is the case here.

rknichols 05-26-2014 04:47 PM

Quote:

Originally Posted by Emerson (Post 5177236)
Drive can present incorrect physical sector size and I'm pretty sure it is the case here.

I looked up that model number on the WD website, and the specs there say the sector size is 512 bytes. Actually, the swap partition is properly aligned, so it should be possible to do some experimenting based on that (and the test I proposed above might not be meaningful).

And now that I notice the results in #9, I can only conclude that something seems seriously wrong with that drive. That test was doing I/O to a properly aligned partition. Let's see the output from "smartctl -A /dev/sda" and see if that reveals anything.

Emerson 05-26-2014 04:55 PM

Well, that leaves IDE mode which should never be used with any POSIX compliant OS.

MisterBark 05-26-2014 05:55 PM

Code:

# smartctl -A /dev/sda
smartctl 5.40 2010-10-16 r3189 [i486-slackware-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG    VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate    0x002f  200  200  051    Pre-fail  Always      -      0
  3 Spin_Up_Time            0x0027  184  172  021    Pre-fail  Always      -      3791
  4 Start_Stop_Count        0x0032  100  100  000    Old_age  Always      -      88
  5 Reallocated_Sector_Ct  0x0033  200  200  140    Pre-fail  Always      -      0
  7 Seek_Error_Rate        0x002e  200  200  000    Old_age  Always      -      0
  9 Power_On_Hours          0x0032  077  076  000    Old_age  Always      -      17371
 10 Spin_Retry_Count        0x0032  100  253  000    Old_age  Always      -      0
 11 Calibration_Retry_Count 0x0032  100  253  000    Old_age  Always      -      0
 12 Power_Cycle_Count      0x0032  100  100  000    Old_age  Always      -      87
192 Power-Off_Retract_Count 0x0032  200  200  000    Old_age  Always      -      77
193 Load_Cycle_Count        0x0032  200  200  000    Old_age  Always      -      10
194 Temperature_Celsius    0x0022  106  103  000    Old_age  Always      -      41
196 Reallocated_Event_Count 0x0032  200  200  000    Old_age  Always      -      0
197 Current_Pending_Sector  0x0032  200  200  000    Old_age  Always      -      0
198 Offline_Uncorrectable  0x0030  200  200  000    Old_age  Offline      -      0
199 UDMA_CRC_Error_Count    0x0032  200  200  000    Old_age  Always      -      0
200 Multi_Zone_Error_Rate  0x0008  200  200  000    Old_age  Offline      -      0

NOTE: uptime is 6 hours (because I had a crash...)


.

rknichols 05-26-2014 07:04 PM

System uptime is irrelevant. The drive accumulates those events internally whenever it is on.

Well, I'm at a loss to explain what is happening. Those SMART attributes all look excellent -- no bad sectors, nothing out of the ordinary. Unless some other process is pounding on the disk or /var/log/messages is overflowing with ATA error messages, I can't imagine what could be going on. Even if there were an alignment issue (which has been ruled out anyway), a 50:1 degradation would be beyond anything I've heard about. This is an ordinary internal disk, not part of some network storage or RAID array, right? By any chance is the BIOS set up for RAID, and writes are always waiting for a missing disk in the array?

Or, perhaps everything you write to the disk is first being sent to the NSA for inspection/audit?? :rolleyes:

Emerson 05-26-2014 07:21 PM

Alright. I'm trying one more time. IDE mode is compatibility mode for Windows XP users so they can boot and install AHCI drivers. Quite clear it is not designed for performance ... ?


All times are GMT -5. The time now is 08:59 AM.