Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: HOWTO: Speed Up Your Hard Drives

  1. #1
    Join Date
    May 2007
    Beans
    3
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Smile HOWTO: Speed Up Your Hard Drives

    Speeding Up Your Hard Drives In Linux
    This is my first post, trying to help anyone who want 's to speed up there hard drives.
    If I'm wrong please correct me, because I know I'm not perfect.

    WARNING THIS USE THIS GUIDE AT YOUR OWN RISK, YOU MAY DAMAGE YOUR DRIVE

    Updated: 13-06-07
    WARNING: Due to kernel updates it is possible for IDE drives to switch to the use of the SCSI driver,
    this will cause that 'hdparm' cannot set certain parameters. Also if you changed your '/etc/fstab' to use certain devices like 'hd*' for
    drive access. The mounting of these drives will fail. And your system may become crippled due to the kernel update.

    SOLUTION for drive addressing in '/etc/fstab' - Use the 'UUID' of the drive instead of a device from '/dev'.

    SOLUTION for the switch to SCSI driver due to kernel updates is still in research.

    Credits for starting this little investigation goes to 'Berserker' for pointing out that 'hdparm' cannot set parameters on SCSI drives. Thanks.


    Why this topic.
    I searched the forum and was unable to find a good subject on speeding up your hard drives.
    If you search the internet because you be leave your hard disk are working to slow, mostly you will come across the same solution. Enabling DMA.

    Of course this is correct, and I will never even attempt to disagree. But there is more to be done.
    This short tutorial is aimed at the rest of the options which are enabled by default on MS Windows, but have to be done manual in Linux.

    This topic is not intended to be for advanced users but for the starters.

    In this example I’m using ‘/dev/hda’ as standard, change it to the hard drive you want to apply the options.

    Requirements: ‘hdparm’.
    Install ‘hdparm’ run:
    Code:
    sudo apt-get install hdparm
    Output is given italic.
    A lot of people are afraid to use hdparm because it can damage your hard drive, that’s why this tutorial also includes some commands to verify for yourself if your drive support the options.

    Step 1: Enabling DMA.
    DMA stands for Direct Memory Access.
    What does it do ?(short version).
    It transfers data from the disk directly to the memory, bypassing the processor, which can and mostly will slow the data transfer.
    So by enabling you gain transfer speed.

    1.A Find out if your drive support DMA.
    Code:
    sudo hdparm -I /dev/hda |grep ‘DMA:’
    - Include the colon’s.
    - Replace /dev/hda with your hard drive
    - I = Captial i
    - To view all the information about your drive run: sudo hdparm –I /dev/hda

    Output in my case:
    Code:
    DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5 udma6
    The ‘*’ tells you that your drive support that particular dma/udma mode.
    In my case my drive support to udma2.

    1.B. Enabling DMA from the console:
    Code:
    sudo hdparm -d1 /dev/hda
    Output in my case:
    Code:
    /dev/hda:
     setting using_dma to 1 (on)
     using_dma    =  1 (on)


    This will activate DMA on your drive, but only while your system is running, to activate the setting every time you boot your system,
    you will have to edit the ‘/etc/hdparm.conf’ file.
    This will be discussed futher on, in step 4.

    Step 2: Enabling 32Bit Input / Output
    What most people don’t know is that when DMA is turned on it automatically only activates 16Bit Input / Output transfer while most systems support up to 32Bit.
    So here we can gain additional speed.

    To enable 32Bit Input / Output run:
    Code:
    sudo hdparm –c1 /dev/hda
    - Replace /dev/hda with your hard drive

    Output in my case:
    Code:
    /dev/hda:
     setting 32-bit IO_support flag to 1
     IO_support   =  1 (32-bit)


    I was unable to find a verification to find out if a drive support it, but I can tell that every system from Pentium II (or equal) and above supports it.
    And hdparm refuses to change the setting if the drive does not support it.
    Downside all current (E)IDE interfaces only have 16Bit over the ribbon cable to the interface.
    If you are working with SATA drives you definitely want to enable this setting.

    Step 3: Multiple Sector Count
    What does it do ? It enables the option to send multiple data sector per I/O Interrupt.
    (Hardware Noob explanation: Multiple post mail deliveries at once, instead of 1 delivery each time the postman visit your house.)
    A setting of 16 or 32 is optimal for most current systems.
    IMPORTANT: On the Western Digital Caviar Disk it’s known that this setting slows them down.
    This setting reduces your operating system overhead by an average between 30%-50%,
    and in most cases it increases data throughput anywhere between 5%-50%.

    3.1 Find out what your drive supports.
    Code:
    sudo hdparm -I /dev/hda |grep 'R/W multiple sector transfer'
    - Include the colon’s
    - Replace /dev/hda with your hard drive.

    Output in my case:
    Code:
    R/W multiple sector transfer: Max = 16  Current = 16


    Look at the value after ‘Max =’ this is the maximum the drives support.
    As you can see after ‘Current is says ‘16’. What we want to achieve is that both values are the same,
    in my case the drive is already correctly activated, because Max and Current have the same value.
    (I didn’t feel like changing it back for this tutorial, I’m sorry )

    3.2 Enabling Multiple Sector Transfer
    Code:
    sudo hdparm –m# /dev/hda
    - Replace # with the value you found at Step 3.1
    - Replace /dev/hda with your hard drive.

    (in my case I ran: sudo hdparm –m16 /dev/had)

    Output in my case:
    Code:
    /dev/hda:
     setting multcount to 16
     multcount    = 16 (on)

    Multiple Sector Transfer is now activated.

    Step 4: Making The Setting Permanent Each Time You Boot
    To set these settings each time you boot you have to edit the ‘/etc/hdparm.conf’ file.

    Open this file with your favorite editor as root, in my case I ran: sudo vi /etc/hdparm.conf

    Scroll to the bottom of the file and add the following:
    Code:
    /dev/hda {
            dma = on
            io32_support = 1
            mult_sect_io = 16
    }
    dma = on (activates DMA – Step 1)
    io32_support = 1 (activates 32Bit Input Output – Step 2)
    mult_sect_io = 16 (activates multiple sector transfer with your drive setting – Step 3, make sure you use the value determent at step 3.1)

    You can run all of this for every hard drive you have. NOT CD/DVD Drives.
    Just make an entry for each drive with it’s own settings.
    Also if you experience slow data transfers for you CD/DVD drives you can also activate DMA on them.

    Example of my /etc/hdparm.conf
    Code:
    /dev/hda {
            dma = on
            io32_support = 1
            mult_sect_io = 16
    }
    /dev/hdb {
            dma = on
    }
    /dev/hdc {
            dma = on
            io32_support = 1
            mult_sect_io = 16
    }
    /dev/hdd {
            dma = on
    }
    /dev/hdb and /dev/hdd are both DVD drives in my case.
    The reason they have not yet the setting io32_support and mult_sect_io with these drives is because,
    I don’t know for sure that these settings also apply to CD/DVD drives.

    ------------------
    Sources Used:
    - Trial And Error
    - Man page hdparm
    - http://www.go2linux.org/node/20

    Tested On:
    Kubuntu 7.04 – 32Bit

    Uninstall / Removal
    - Purge your drive entries from /etc/hdparm.conf

    ------------------
    I hope this tutorial is useful to someone.
    Last edited by BlackPhoenixx; June 13th, 2007 at 12:14 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    France
    Beans
    7,100
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Speed Up Your Hard Drives

    Nice guide

    Don't forget to warn users about the potential risk of such tweaks, just to let them aware of that.

  3. #3
    Join Date
    May 2007
    Beans
    3
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Speed Up Your Hard Drives

    Quote Originally Posted by frodon View Post
    Nice guide

    Don't forget to warn users about the potential risk of such tweaks, just to let them aware of that.
    I put in an warning as requested.

  4. #4
    Join Date
    Jun 2005
    Location
    France
    Beans
    7,100
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Speed Up Your Hard Drives

    You rock

  5. #5
    Join Date
    Feb 2007
    Location
    Here
    Beans
    64
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Speed Up Your Hard Drives

    While the grep shows support for the enhanced modes I get these messages when executing commands as root:

    hdparm -I /dev/sdb | grep 'DMA:'
    Code:
            DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5 udma6

    hdparm -d1 /dev/sdb

    Code:
    /dev/sdb:
     setting using_dma to 1 (on)
     HDIO_SET_DMA failed: Inappropriate ioctl for device
    hdparm -d1 /dev/sda
    Code:
    /dev/sda:
     setting using_dma to 1 (on)
     HDIO_SET_DMA failed: Inappropriate ioctl for device
    TBH I'm trying it from Zenwalk but it is a HOWTO for linux so I thought I'd throw it your way.
    quidquid latine dictum sit altum viditur - Whatever is said in Latin sounds profound

  6. #6
    Join Date
    Aug 2006
    Location
    Poland
    Beans
    Hidden!

    Re: HOWTO: Speed Up Your Hard Drives

    Code:
    andrzej@andrzej-desktop:~$ sudo hdparm –m16 /dev/hda
    –m16: No such file or directory
    but
    Code:
    sudo hdparm -I /dev/hda |grep 'R/W multiple sector transfer'
    works well..
    Last edited by andrek; June 1st, 2007 at 02:51 PM.

  7. #7
    Join Date
    Jun 2007
    Beans
    4

    Re: HOWTO: Speed Up Your Hard Drives

    andrek, you are using two different dashes: – in –m16 is not the same as - in -I. Try

    Code:
    sudo hdparm -m16 /dev/hda
    Hope it helps

    soundray

  8. #8
    Join Date
    Jun 2005
    Beans
    173

    Re: HOWTO: Speed Up Your Hard Drives

    Quote Originally Posted by Docter View Post
    While the grep shows support for the enhanced modes I get these messages when executing commands as root:

    hdparm -I /dev/sdb | grep 'DMA:'
    Code:
            DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5 udma6

    hdparm -d1 /dev/sdb

    Code:
    /dev/sdb:
     setting using_dma to 1 (on)
     HDIO_SET_DMA failed: Inappropriate ioctl for device
    hdparm -d1 /dev/sda
    Code:
    /dev/sda:
     setting using_dma to 1 (on)
     HDIO_SET_DMA failed: Inappropriate ioctl for device
    TBH I'm trying it from Zenwalk but it is a HOWTO for linux so I thought I'd throw it your way.
    hdparm can't set DMA for SCSI drives or IDE drives that use the SCSI driver (/dev/sd*).

  9. #9
    Join Date
    Aug 2006
    Location
    Poland
    Beans
    Hidden!

    Re: HOWTO: Speed Up Your Hard Drives

    Quote Originally Posted by soundray View Post
    andrek, you are using two different dashes: – in –m16 is not the same as - in -I. Try

    Code:
    sudo hdparm -m16 /dev/hda
    Hope it helps

    soundray
    Thanks, works well.

  10. #10
    Join Date
    May 2005
    Location
    South East Michigan
    Beans
    81

    Re: HOWTO: Speed Up Your Hard Drives

    I am trying to understand this, When I first tested to see my current speeds

    $ sudo hdparm /dev/hda

    /dev/hda:
    multcount = 0 (off)
    IO_support = 0 (default 16-bit)
    unmaskirq = 0 (off)
    using_dma = 1 (on)
    keepsettings = 0 (off)
    readonly = 0 (off)
    readahead = 256 (on)
    geometry = 65535/16/63, sectors = 156301488, start = 0

    $ sudo hdparm -tT /dev/hda

    /dev/hda:
    Timing cached reads: 1488 MB in 2.00 seconds = 743.67 MB/sec
    Timing buffered disk reads: 96 MB in 3.01 seconds = 31.91 MB/sec

    then I made the changes:

    $ sudo hdparm /dev/hda
    /dev/hda:
    multcount = 16 (on)
    IO_support = 1 (32-bit)
    unmaskirq = 0 (off)
    using_dma = 1 (on)
    keepsettings = 0 (off)
    readonly = 0 (off)
    readahead = 256 (on)
    geometry = 65535/16/63, sectors = 156301488, start = 0

    $ sudo hdparm -tT /dev/hda
    /dev/hda:
    Timing cached reads: 1084 MB in 2.00 seconds = 541.14 MB/sec
    Timing buffered disk reads: 84 MB in 3.06 seconds = 27.48 MB/sec

    Am I reading this wrong? It looks like I am loosing performance by enabling multicount and IO_support.
    gotmonkey
    chown -R us ./base

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •