12

I have just installed Debian testing on my new desktop and I am not very happy with performance - when I perform a disk intensive operation, e.g. upgrade packages in the system, everything seems to freeze, e.g. changing tabs in Iceweasel takes 3 seconds. I run the Debian on my 3 year old Thinkpad X60 ultra-portable, and I don't have these issues. (every single parameter of the laptop is much worse than the desktop).

I am using the default packaged kernel and scripts.

I run

hdparm -t /dev/sda1

And I got around 96GB/s, which is expected. What else can I try to make it work better?

EDIT:

grzes:/home/ga# hdparm -i /dev/sda

/dev/sda:

 Model=WDC WD15EARS-00Z5B1, FwRev=80.00A80, SerialNo=WD-WMAVU1362357
 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=2930277168
 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=no WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

EDIT2: Even my wife said "on this new computer I can't do anything when I copy the photos from the camera and its much worse than on the old one". So it must be serious.

EDIT3: Updated to 2.6.32, but still no improvement

EDIT4: I forgot to mention that the new disk is ext4, the old was ext3.

EDIT5: Still not solved. I have a P43 ASUS P5QL-E board. Lines from dmesg that seem relevant:

[    0.370850] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)                              
[    0.370852] io scheduler noop registered                                                                      
[    0.370853] io scheduler anticipatory registered                                                              
[    0.370854] io scheduler deadline registered                                                                  
[    0.370876] io scheduler cfq registered (default)
...
[    0.908233] ata_piix 0000:00:1f.2: version 2.13                                                               
[    0.908243] ata_piix 0000:00:1f.2: PCI INT B -> GSI 19 (level, low) -> IRQ 19                                 
[    0.908246] ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]                                                        
[    0.908275] ata_piix 0000:00:1f.2: setting latency timer to 64                                                
[    0.908316] scsi0 : ata_piix                                                                                  
[    0.908374] scsi1 : ata_piix                                                                                  
[    0.909180] ata1: SATA max UDMA/133 cmd 0xa000 ctl 0x9c00 bmdma 0x9480 irq 19                                 
[    0.909183] ata2: SATA max UDMA/133 cmd 0x9880 ctl 0x9800 bmdma 0x9488 irq 19                                 
[    0.909199] ata_piix 0000:00:1f.5: PCI INT B -> GSI 19 (level, low) -> IRQ 19                                 
[    0.909202] ata_piix 0000:00:1f.5: MAP [ P0 -- P1 -- ]                                                        
[    0.909228] ata_piix 0000:00:1f.5: setting latency timer to 64                                                
[    0.909279] scsi2 : ata_piix                                                                                  
[    0.909326] scsi3 : ata_piix                                                                                  
[    0.910021] ata3: SATA max UDMA/133 cmd 0xb000 ctl 0xac00 bmdma 0xa480 irq 19                       
3
  • 1
    I also have the same problem. I use ubuntu 9.10 64 bit. Jan 28, 2010 at 11:39
  • 1
    any updates to this? still having the issue? if so, can you tell us what chipset the motherboard is using? anything interesting in dmesg regarding the chipset or drive? if you fixed it somehow, consider posting a writeup as an answer to let future readers know. Feb 13, 2010 at 6:18
  • @~quack, not solved yet, please see edit.
    – Grzenio
    Feb 14, 2010 at 19:29

8 Answers 8

4

Check the offset for the partition - needs to be divisable by 4 for EARS as they have the 4096 technology. If it isn't - repartition it to get alignment and performance issues should go away (misaligned EARS drives will be doing a lot more sector writes per op).

4
  • ooOOOOooo. you might be on to something. dmesg output indicates it might be detecting the drive as a 512-byte sector drive: "[sda] 2930277168 512-byte logical blocks" .. is there an "XP jumper" on the drive that would set some sort of compatibility mode? there is... see "Advanced Format" jumper here: wdc.custhelp.com/cgi-bin/wdc.cfg/php/enduser/… .. that probably tells the OS it's got 512-byte sectors, make sure it's not set. Mar 25, 2010 at 23:45
  • thanks for you answer. Could you tell me how do I check the offset? Can I just move the partition, or do I have to recreate it?
    – Grzenio
    Mar 27, 2010 at 12:46
  • Is there a way to check the offset on the partition? A command that could be run?
    – Warren P
    Feb 6, 2011 at 22:22
  • You can use gdisk to check partition offsets -- rodsbooks.com/gdisk Feb 23, 2011 at 21:22
4

I had similar freeze issue when doing a lot of disk IOs. During a backup the desktop was freezing for a few seconds again and again until the backup finished.

It was not related to any alignment nor any hdparm tuning (although I agree it will help).

The system lockup was caused by the IO scheduler which delays too much some IOs required by more interactive applications (Firefox, KDE or whatever). The faulty IO scheduler was cfg.

To solve the issue, you have to use the deadline IO scheduler. You activate it on a disk with the following command that you can add in /etc/rc.local:

echo deadline >  /sys/block/sda/queue/scheduler

Check Solving Linux system lock up when intensive disk I/O are performed for more information.

2

It's a shot in the dark, but I've had a problem like this a while ago, and the cause turned out to be that the kernel did not support the chipset completely and DMA was turned off. Check with

hdparm -i /dev/sda

whether one of the DMA modes is enabled.

(The solution in that case was to get a newer kernel.)

6
  • OUTPUT:- DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 so, whats the problem?? Jan 28, 2010 at 12:40
  • I got: Model=WDC, FwRev=80.00A80, SerialNo=WD-WMAVU1362357 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50 BuffType=unknown, BuffSize=0kB, MaxMultSect=16, MultSect=16 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=2930277168 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=no WriteCache=enabled Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7
    – Grzenio
    Jan 28, 2010 at 22:19
  • No dma mode seems to have a star (it its relevant). Does it matter? How can I configure it?
    – Grzenio
    Jan 28, 2010 at 22:20
  • Also I am not sure if its not relevant only for IDE devices, because I get: hdparm -d /dev/sda /dev/sda: HDIO_GET_DMA failed: Inappropriate ioctl for device
    – Grzenio
    Jan 28, 2010 at 22:22
  • @Grzenio: the udma6 mode seems to have a star, is that incorrect? might want to edit this info into your post so you can format it. Jan 29, 2010 at 0:20
2

I've run into problems where operations which perform lots of fsync(2) calls will cause a major system slowdown. In my case, I'm running with my root partition contained in LVM contained in LUKS. Are you using either LVM or LUKS?

A tool which may help pinpoint what specifically is chewing up your disks (rather than just "installing packages") is called iotop. I'd suggest running it while you do one of these tasks, and it may point out some other background process which may be triggering at the same time and sucking up all of your I/O throughput.

2
  • Hi, sorry for a late reply: iotop says that [jbd2/sda3-8] uses 80%-99% IO, but disk read, write and swapin are 0.0 at the same time. Any ideas?
    – Grzenio
    Feb 20, 2010 at 18:18
  • In general, checking for excessive fsync is a good point to check. However in this case the same software performs much better on other hardware (the old T60), so it looks more like a problem with this particular hardware-driver combination. Still, good to keep this in mind.
    – sleske
    Jun 21, 2010 at 10:27
2

sudo fdisk -u /dev/sda

That should give you the starting offset. I 'think' you can create the partition using fdisk -o 64 or something - I would have to google it so Ill let you do the googling on fdisk and manually setting the partition offset (default is 63 so thats no good).

and yes the disk will show with 512b sectors as it pretends to be as such to the OS - Vista/W7 handle this by setting the correct offset, but XP and I think near all linus distros dont :( manually is the only way it seems (mine is just a storage drive and created in win7/ntfs so its no issue for me)

Edit: - Found a nice post over at wdc - this should have you up and running in no-time :)

http://community.wdc.com/t5/Desktop/Problem-with-WD-Advanced-Format-drive-in-LINUX-WD15EARS/m-p/10920#M631

2
  • Hi, I got: grzes:/home/ga# fdisk -u /dev/sda The number of cylinders for this disk is set to 182401. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help):
    – Grzenio
    Mar 29, 2010 at 21:11
  • I finally managed to get it done, but it didn't really help :( The real issue must be somewhere else.
    – Grzenio
    Jun 9, 2010 at 19:24
1

Just a random shot, which seems stupid given that you use Debian... but I found that it helped someone with the same HDD model: have you tried to update your BIOS?

1
  • No, I haven't. Worth trying though probably
    – Grzenio
    Jun 10, 2010 at 8:05
1

As a general rule of thumb, if you can use hdparm on the device, it's the "old" ATA interface, vs. the newer SATA/SCSI interface. If that is the case, then the problem is probably that disk ops during interrupts are not enabled by default. This is a common issue on some machines using the older ATA interface and will degrade performance of the disk or the system during heavy I/O operations.

You really should try this:

sudo hdparm -t -T /dev/sda
sudo hdparm -a8 -c3 -u1 /dev/sda
sudo hdparm -t -T /dev/sda

If you don't see an improvement in performance on the 2nd timing run (the third command) then there's something else going on.

Another factor is expecting UDMA6 mode to work over a non-UDMA cable (assuming it's not a SATA interface). If you are using an 80-pin ATA cable, you're fine; if you're using an older 40-pin, you'll get all kinds of grief. If the cable is the older 40-pin, you'll need to step the transfer rate down to something that can be supported "safely". WARNING: adjusting the IDE interface can hang the drive and/or interface, and if the drive is your root filesystem, the entire system will hang with it!

Should you need to step down the transfer rate to match the hardware, try the following:

sudo hdparm -t -T /dev/sda
sudo sync; sleep 3 ; sync    
sudo hdparm -d 1 -X mdma2 /dev/sda
sudo hdparm -t -T /dev/sda

Again, the second timing (third command issued) should show an improvement.

Lastly, the drive itself might be marginal, but without SMART reporting, you might not notice the issue (until it's too late). I would really recommend installing the smartmontools package to assist you, especially if you have an older drive that will be needing a little TLC now and then.

sudo apt-get update && apt-get install smartmontools

IF all else fails, look in /var/log/messages for disk I/O errors.


Update:

It appears you're not alone. There are message boards all over the 'net reporting all kinds of heartache with these units.

There is also mention of the drive using a 4k sector size vs. the "traditional" 512 byte size. I can only imagine what kind of trouble this must be causing.

Lastly, looking at your output again, it appears that the journaling thread is pretty much tying up the system. A non-journaled file system might temporarily alleviate the issue, but it's prophylactic at best, and doesn't fix the problem at worst.

4
  • Hi, thanks for your reply. (1) This IS a SATA drive and its connected using a thin sata cable to the sata interface on the mainboard. (2) Tried the first test, and performance actaully decreased from 90.93 MB/sec to 52.50 MB/sec. The raw read performance doesn't seem to be the issue (90MB is what I expect from this drive), its just that some minor operations freeze the system
    – Grzenio
    Jun 10, 2010 at 8:21
  • The second test didn't really improve anything either. In both the first case and the second most of the parameters fail to be set: hdparm -d 1 -X mdma2 /dev/sda /dev/sda: setting using_dma to 1 (on) HDIO_SET_DMA failed: Inappropriate ioctl for device setting xfermode to 34 (multiword DMA mode2) HDIO_DRIVE_CMD(setxfermode) failed: Invalid exchange HDIO_GET_DMA failed: Inappropriate ioctl for device
    – Grzenio
    Jun 10, 2010 at 8:24
  • I installed smartmontools yesterday, but I don't know how to use them. Could you give a bit more detail?
    – Grzenio
    Jun 10, 2010 at 8:24
  • Ouch. So a new hard drive would be a good idea.
    – Warren P
    Feb 6, 2011 at 22:23
1

This is finally fixed! As @Rachel pointed out, the problem indeed was with alignment to the 4kb sectors, but unfortunately the article linked was incorrect :(

The correct way to align partitions is here: http://www.linuxconfig.org/linux-wd-ears-advanced-format

And this article gives a pretty good benchmark so that you can check if your partition table is correct: http://article.gmane.org/gmane.linux.utilities.util-linux-ng/2955

On a side note, if you have this drive and use Linux, you also SHOULD increase one of the idle timers as described here: http://wdc.custhelp.com/cgi-bin/wdc.cfg/php/enduser/std_adp.php?p_faqid=5357&p_created=1266947046&p_sid=Os7DQL2k&p_accessibility=0&p_redirect=&p_srch=1&p_lva=&p_sp=cF9zcmNoPTEmcF9zb3J0X2J5PSZwX2dyaWRzb3J0PSZwX3Jvd19jbnQ9NTEsNTEmcF9wcm9kcz0yMjcsMjk0JnBfY2F0cz0xMzAmcF9wdj0yLjI5NCZwX2N2PTEuMTMwJnBfcGFnZT0x&p_li=&p_topview=1

1
  • 2nd link doesn't work any replacement?
    – xliiv
    Nov 23, 2019 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .