Debian This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
03-12-2006, 01:05 PM
|
#1
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Rep:
|
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?
|
|
|
03-13-2006, 07:31 AM
|
#2
|
Senior Member
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199
Rep:
|
Write cache is enabled by default in the kernel.
Add a bootscript with the following lines to runlevel 5:
#!/bin/bash
hdparm -W0 /dev/hdb
|
|
|
03-13-2006, 10:25 AM
|
#3
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Original Poster
Rep:
|
Quote:
Add a bootscript ... to runlevel 5:
|
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?
|
|
|
03-13-2006, 06:56 PM
|
#4
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Original Poster
Rep:
|
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'
|
|
|
03-13-2006, 08:03 PM
|
#5
|
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642
Rep:
|
Moved to Distributions - Debian per request
|
|
|
03-13-2006, 08:24 PM
|
#6
|
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249
Rep:
|
Quote:
Originally Posted by rickh
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.
|
|
|
03-13-2006, 08:35 PM
|
#7
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Original Poster
Rep:
|
Ah! That's exactly what I needed. If fact, such a line is already there, I just have to uncomment it. Thanks.
|
|
|
03-13-2006, 09:10 PM
|
#8
|
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249
Rep:
|
Quote:
Originally Posted by rickh
Ah! That's exactly what I needed. If fact, such a line is already there, I just have to uncomment it. Thanks.
|
No problems...
|
|
|
03-13-2006, 09:21 PM
|
#9
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Original Poster
Rep:
|
...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:
Quote:
debian:~# hdparm -i /dev/hdb
/dev/hdb:
Model=WDC WD800JB-00JJC0, FwRev=05.01C05, SerialNo=WD-WMAM98691672
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=66
BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=off
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1 ATA/ATAPI-2 ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6
* signifies the current active mode
|
Evidently that script is not being invoked during the boot?
|
|
|
03-13-2006, 09:30 PM
|
#10
|
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249
Rep:
|
Quote:
Originally Posted by rickh
...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.
Is there any script in your system ??
|
|
|
03-13-2006, 10:01 PM
|
#11
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Original Poster
Rep:
|
Yeah. I have such a script, and also I notice that /etc/rcS.d/ includes S07hdparm
Is that where it belongs?
|
|
|
All times are GMT -5. The time now is 12:53 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|