Seven Practical Tips for optimizing Linux server hard drive performance

Source: Internet
Author: User
Article Title: seven practical tips for optimizing the hard drive performance of Linux servers. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In Windows, disk fragmentation is a common problem. If you do not pay attention to it, the system performance may be eroded. Linux uses the second extended File System (ext2), which processes file storage in a completely different way. Linux does not have the problem found in Windows systems, which makes many people think that disk fragmentation is not a problem at all. However, this is incorrect.
 
All file systems tend to be fragmented over time. Linux file systems reduce fragmentation, but they are not eliminated. Because it does not often appear, it may not be a problem for a single-user workstation. However, in busy servers, file fragmentation will reduce hard disk performance over time. Hard Disk performance can only be noticed when data is read or written from the hard disk. The following are some specific measures to optimize the hard disk performance of Linux.
 
  I. Clear Disks
 
This method looks simple: Clear the disk drive, delete unnecessary files, and clear all files that need to be saved but will not be used. If possible, clear unnecessary directories and reduce the number of subdirectories. These suggestions seem obvious, but you will be surprised to find that each disk has accumulated a lot of garbage. Releasing disk space can help the system work better.
 
  Ii. Sort disk fragments
 
The disk fragment program on Linux is different from that on Windows 98 or Windows NT. Windows 98 introduces the FAT 32 file system, although running Windows 98 does not have to be converted to a FAT 32 file system. Windows can be set to use FAT or an enhanced file system called NTFS. All these file systems process file storage in essentially the same way.
 
In Linux, the best way to clear disk fragments is to make a full backup, reformat the partition, and restore the file from the backup. When files are stored, they are written to contiguous blocks without fragmentation. This is a big job. It may be unnecessary for program partitions that do not change frequently like/usr, but it can create a miracle in the/home partition of a multi-user system. It takes the same time as the disk fragmentation of the Windows NT Server.
 
If the disk performance is still unsatisfactory, there are many other steps to consider, but any hardware solution that includes upgrading or purchasing new devices may be expensive.
 
  3. upgrade from IDE To SCSI
 
If your hard disk is an IDE drive, you can upgrade it to the SCSI drive for better overall performance. Because the IDE controller must access the CPU, CPU and disk-intensive operations may become very slow. The SCSI controller does not need to process read/write through the CPU. When the IDE drive is reading or writing, the user may complain about the slow system because the CPU cycle is occupied by the IDE drive.
 
Get faster controllers and disk drives
 
Standard SCSI controllers cannot read and write data faster than standard IDE controllers, but some very fast "UltraWide" SCSI controllers can make a real leap in read and write speed.
 
The EIDE and UDMA controllers are very fast IDE controllers. The new UDMA controller can speed up to the SCSI controller. The top-level speed of the UDMA controller is the burst speed, but the continuous transmission speed is much slower. The IDE controller, including UDMA, is embedded in the drive itself. You do not need to buy a controller. You only need to buy a drive, which includes the Controller to achieve UDMA performance.
 
Disk drives often overlook the speed of disks. The disk speed is measured in rpm, which indicates how many times a disk is rotated per minute. The larger the rpm, the faster the disk speed. If you have a budget for this, most server system vendors can provide 7500rpm or even 10000 rpm SCSI disks. Standard SCSI and IDE disks provide 5400rpm speed.
 
  4. Use multiple controllers
 
The IDE and SCSI disks can be linked. The IDE chain consists of up to two devices, and the standard SCSI chain consists of up to seven devices. If two or more SCSI disks exist in the system, they may be linked to the same controller. This is sufficient for most operations, especially when the computer is used as a single-user workstation. However, if there is a server, you can improve performance by providing a controller for each SCSI drive. Of course, good controllers are expensive.
 
  5. Adjust hard disk Parameters
 
The hdparm tool can be used to adjust the performance of the IDE hard disk. It is designed specifically to use the UDMA drive. By default, Linux is the safest to use, but it is the slowest to access the IDE drive. The default mode does not use UDMA for the fastest possible performance.
 
Using hdparm can significantly improve performance by activating the following features:
 
◆ 32-bit support 16-bit by default;
 
◆ The default setting for multi-part access is to interrupt single-part transfer at a time.
 
Note: Before using hdparm, make sure that the system has been completely backed up. Using hdparm to change IDE parameters may cause loss of all data on the drive if an error occurs.
 
Hdparm can provide a large amount of information about hard disks. Open a terminal window and enter the following command to obtain information about the first IDE drive in the system (change the device name to obtain information about other IDE drives ):
 
Hdparm-v/dev/had
 
The above command shows the information obtained from the drive when the system starts, including whether the drive operation is multi-part access (Multcount) in 16-bit or 32-Bit mode (I/O Support ). You can use the-I parameter to display more detailed information about the disk drive.
 
Hdparm can also test the drive transmission rate. Enter the command to test the first IDE drive in the system:
 
Hdparm-Tt/dev/hda
 
This test measures the speed at which the drive reads directly and caches the memory. The result is an optimized "Best case" number. Change the drive settings and activate the 32-bit transmission. Enter the following command:
 
Hdparm-c3/dev/hda
 
-The c3 parameter is supported by 32-bit activation. You can use-c0 to cancel it. -The c1 parameter can also activate 32-bit support and use less memory overhead, but it does not work in many drives.

[1] [2] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.