Thursday, December 28, 2006

A simple way 2 fix DMA problem of HDD in windows XP

Windows XP has a somewhat bad (IMHO) feature
that sets off the DMA of hard drives and CD/DVD drives when it gets CRC error in
reading the filesystem. This frequently happens when you are having subsequent power
cuts or if you have a bad sectors in your drive. And thus PC crawls when we want
to access data from that drive, as OS then retrieves data in PIO mode.



This problem has been bugging me for some time. So hacked my way into "regedit"
and finally made this script. This script deletes the registry entry that Windows
uses to calculate what addressing mode to use when accessing the drives. So upon
running the script, just rebooting PC will
force windows re-detect the drive resulting in restoration of UDMA mode 5 for the
hard drive.



Here is the code


#####################

REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0001
/v "MasterIdDataCheckSum" /f



REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0001
/v "SlaveIdDataCheckSum" /f



REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002
/v "MasterIdDataCheckSum" /f



REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002
/v "SlaveIdDataCheckSum" /f

#####################



Put this code fragment inside a text file and rename it to
"dma_restore.bat" or something like
it. Make sure you change the extension to ".bat".
Upon running the file, you may see some errors like "Error: the
system was unable to find the specific registry key or value". Do not worry
about it. Just
reboot
and your PC should be
fine in the next run.


Saturday, October 21, 2006

Take care of your hard disks with hdparm

The main problem that we all face with our hard disk is bad sector and subsequent data loss for that. Everybody know what is the blow of such data loss, specially if you are using your PC as a web server or database server.

There are various reasons for which your hard disk can get bad sectors. The most prominent of them is sudden power failure. As the disk constantly keeps spinning at 5400-10000 rpm depending on hdd model, if the disk is being accessed (data being written and read) when the power failure occurs, the head may write down abnormal data and bad sector can occur from that.

Now a days, most OS by default takes advantage of a feature called write-caching incorporated in modern hard disk drives to boost write performance. While increasing write throughput, the feature indirectly increases the risk of data corruption and bad sectors as your drive keeps constantly writing to disk.

So its a very good idea to disable write-caching in your hard drive if your disk has sensitive data. To accomplish that we are going to use a very handy tool in UNIX, hdparm.

'hdparm' is a tool designed to manage every setting of your hard drive. With this tool, you can tune your hard drive to your style. With some settings activated your hard drive will give you highest performance (with the risk of data loss when power failure occurs) and with others you can ensure maximum safety of your data at the expense of performance.

Now if u want maximum safety for your data, just run the following in root shell (be warned that you won't get maximum performance from your drive):

#hdparm -W 0 /dev/hda
[Note: replace hda with your drive identifier]

This effectively turns write-cache off.

If you want to automatically deactivate write-cache off on your hard drive, then add these lines in /etc/hdparm.conf:

/dev/hda {
mult_sect_io = 16
write_cache = off
dma = on
defect_mana = on
}

On the other hand if you want to gain performance by pushing your hard drive to the edge (but this may make your hard drive more prone to data corruption in case of power failure):

#hdparm -d 1 -A 1 -m 16 -u 1 -a 64 -X udma5 /dev/hda

or add these lines in /etc/hdparm.conf:

/dev/hda {
lookahead = on
write_cache = on
read_ahead_sect = 64
dma = on
mult_sect_io = 16
interrupt_unmask = on
transfer_mode = 69
}

Your hard drive should be running in turbo mode by now (but you won't notice any difference if these settings were enabled by default).

--
Time heals every wound, but time itself is a wound that never heals.

Monday, September 25, 2006

gtk2-engines-gtk-qt

“The GTK-Qt Theme Engine (also known as gtk-qt-engine) is a GTK 2 theme engine
that calls Qt to do the actual drawing. This makes your GTK 2 applications
look almost like real Qt applications and gives you a more unified desktop
experience.

Please note that this package is targeted at KDE users and therefore provides
a way to configure it from within KControl.”

Monday, January 08, 1990

Welcome

This is a blog we created to share our everyday works with others, we are mainly interested in unix and its flavours like linux, freeBDS and more. Here we are to share the tips and tricks so that we can increase our productivity.