How can I permanently turn off 'Write Cache' ---Debian
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I permanently turn off 'Write Cache' ---Debian
I have been working on setting up some POSTGRESQL databases ... Nothing critical yet, but I'm getting ready. Did a dist-upgrade this morning, and POSTGRESQL was one of the programs updated. When it restarted, there was a message:
Quote:
Starting PostgreSQL 7.4 database server: main.
Warning: The following devices contain databases and have write
caching enabled: /dev/hdb
This could destroy the integrity of your databases in the event of power
failure. Consider disabling the write cache with "hdparm -W 0 <device>".
The hdparm command does the job, but after a reboot, 'write caching' is enabled again.
What is the correct way to turn it off permanently?
I am aware that such a thing can be done, but vague about just how to go about it. As far as I can tell there are currently no 'bootscripts' on my system apart from the various bashrc files. Just where would this script go, and what would initialize it?
I have searched around a whole lot more for instructions on how to do this ... unsuccessfully. I guess what I really want to know is if there is a 'Debian' way. Even better, is there a system script already out there in which I should just append the line 'hdparm -W0 /dev/hdb'
I am aware that such a thing can be done, but vague about just how to go about it. As far as I can tell there are currently no 'bootscripts' on my system apart from the various bashrc files. Just where would this script go, and what would initialize it?
You can put the hdaprm command in /etc/hdparm.conf file towards the end. So Everytime you reboot your system, it will execute the command and you will be able to disable the write cache.
...Except, it didn't work. I tried a couple optional methods described in /etc/hdparm.conf:
Code:
/dev/hdb {
write_cache = off
}
and
Code:
command_line {
hdparm -W0 /dev/hdb
}
but either way after a reboot:
Evidently that script is not being invoked during the boot?
Well sad to know that. Actually on my system, the script gets invoked everytime I boot my system.
Ah, I just observed that I have script called hdparm in my /etc/init.d directory which is linked to rcN.d directories and that's why it is getting invoked in my case. It was there by default.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.