Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to enable Direct memory access (DMA) on your SATA/IDE hard disk

Answer:

Execute the following command

# hdparm -d1 /dev/hda

Where hda is the first hard disk in your system.

How to test the speed of your ATA hard disk

Answer:

With the help of hdparm command:

# hdparm -tT /dev/hda

/dev/hda:
Timing cached reads: 1352 MB in 2.00 seconds = 676.23 MB/sec
Timing buffered disk reads:86 MB in 3.01 seconds = 28.67 MB/sec

How to save the output from top command

Answer:

Use the following tricks to save the output of top command into a file.

# top -n1 > output.txt

Reduce the chance of using swap if you have enough memory

Answer:

If you have enough memory but the Linux is still using swap at sometimes, you can adjust the swappiness parameter

1. See the current setting

# cat /proc/sys/vm/swappiness
60

The range is from 0 to 100 (lower value means you system will try to avoid swap as much as possible)

2. To set a lower value at runtime

# echo "30" >  /proc/sys/vm/swappiness

3. To set it permanently

# /sbin/sysctl -w vm.swappiness=30

Reboot after the changes.

Turn off ETag in Apache

Answer:

ETag should not be used in Apache unless you know what they are really for.

Edit the Apache configuration: vi httpd.conf

Add:

FileETag None

Then restart Apache.