NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Scouser
Jan 19, 2012Aspirant
Write-cache problems
Is there a way to disable disk write-cache permanently until such time that I might want to turn it back on again.
I need to do this manually via some configuration file or command line utility and NOT via frontview.
Here's my problem:
I have two 1.5Tb Seagate ST31500341AS Rev level SD37 disks installed in my Pro 6. If write-cache is enabled, they freeze every now and then and when this happens the NAS becomes unavailable and everything communicating with the NAS via the network hangs until the disks reset and spin back up again. This takes about 30 seconds on average and the disk freeze happens roughly every 7 minutes. Turning write-cache off totally stops the disk freeze problem occurring.
This Seagate disk freeze problem is as old as the moon but it is supposed to be fixed in Rev SD37. It obviously isn't. But Seagate are adamant it is fixed and they will not help me any further with the problem.
I use my Pro 6 as a media server. You can imagine the frustration while watching a movie on my TV client when it hangs and says "please wait" and you then wait for 30 seconds for the movie to resume, and in some circumstances the TV times out and the movie is kicked off the TV entirely.
Anyway, I have discovered that turning write-cache off fixes my problem.
One would think the easy thing to do then would be to simply turn write-cache off in Frontview. I do this, but I have noted several times where write-cache is magically tured back on by itself! First of all, the disabling of write-cache via frontview is not preserved across reboots. So, after disabling the write-cache in FV, if the NAS is rebooted, it comes up with write-cache enabled - even though FV reports that it is disabled!. This is annoying. It's not that I reboot that often but when I do, the system should recognise that I had previously disabled write-cache and thus disable it accordingly. I have also noticed that write-cache is curiously re-enabled if my UPS has a power outage. The UPS has no issue supplying uninterrupted power to the NAS but when this happens, write-cache is re-enabled again. Finally, I run an on-line filesystem consistency check once a week in the early hours of Sunday mornings. But after I login on each Sunday I see in Frontview and in my /var/log/syslog that disk write-cache has again been magically re-enabled.
So, notwithstanding there is obviously a bug somewhere, is there a config file or command line utility that I can use to permanently turn the damn write-cache off?
Just in case you might suggest it, replacing the Seagate disks is not an option. And besides they are supported disks in the HCL.
One other thing, with write-cache disabled, I find the performance of the system is not affected. But how the flippin heck do you turn the damn thing off?
Any suggestions appreciated.
I need to do this manually via some configuration file or command line utility and NOT via frontview.
Here's my problem:
I have two 1.5Tb Seagate ST31500341AS Rev level SD37 disks installed in my Pro 6. If write-cache is enabled, they freeze every now and then and when this happens the NAS becomes unavailable and everything communicating with the NAS via the network hangs until the disks reset and spin back up again. This takes about 30 seconds on average and the disk freeze happens roughly every 7 minutes. Turning write-cache off totally stops the disk freeze problem occurring.
This Seagate disk freeze problem is as old as the moon but it is supposed to be fixed in Rev SD37. It obviously isn't. But Seagate are adamant it is fixed and they will not help me any further with the problem.
I use my Pro 6 as a media server. You can imagine the frustration while watching a movie on my TV client when it hangs and says "please wait" and you then wait for 30 seconds for the movie to resume, and in some circumstances the TV times out and the movie is kicked off the TV entirely.
Anyway, I have discovered that turning write-cache off fixes my problem.
One would think the easy thing to do then would be to simply turn write-cache off in Frontview. I do this, but I have noted several times where write-cache is magically tured back on by itself! First of all, the disabling of write-cache via frontview is not preserved across reboots. So, after disabling the write-cache in FV, if the NAS is rebooted, it comes up with write-cache enabled - even though FV reports that it is disabled!. This is annoying. It's not that I reboot that often but when I do, the system should recognise that I had previously disabled write-cache and thus disable it accordingly. I have also noticed that write-cache is curiously re-enabled if my UPS has a power outage. The UPS has no issue supplying uninterrupted power to the NAS but when this happens, write-cache is re-enabled again. Finally, I run an on-line filesystem consistency check once a week in the early hours of Sunday mornings. But after I login on each Sunday I see in Frontview and in my /var/log/syslog that disk write-cache has again been magically re-enabled.
So, notwithstanding there is obviously a bug somewhere, is there a config file or command line utility that I can use to permanently turn the damn write-cache off?
Just in case you might suggest it, replacing the Seagate disks is not an option. And besides they are supported disks in the HCL.
One other thing, with write-cache disabled, I find the performance of the system is not affected. But how the flippin heck do you turn the damn thing off?
Any suggestions appreciated.
5 Replies
Replies have been turned off for this discussion
- ScouserAspirantFor anyone interested, here is my syslog data after the UPS kicked in on a power fail:
Jan 19 15:20:46 MainStore RAIDiator: UPS has been disconnected.
Jan 19 15:20:46 MainStore RAIDiator: UPS has been disconnected.\n[Thu Jan 19 15:20:46 WET 2012]
Jan 19 15:20:53 MainStore hidups[11836]: Startup successful
Jan 19 15:20:55 MainStore upsd[11843]: Connected to UPS [UPS]: hidups-hiddev0
Jan 19 15:20:55 MainStore upsd[11844]: Startup successful
Jan 19 15:20:56 MainStore upsmon[11857]: Startup successful
Jan 19 15:20:56 MainStore upsmon[11857]: Warning: running as one big root process by request (upsmon -p)
Jan 19 15:20:56 MainStore upsd[11844]: Client monuser@127.0.0.1 logged into UPS [UPS]
Jan 19 15:20:56 MainStore kernel: ata1.00: configured for UDMA/133
Jan 19 15:20:56 MainStore kernel: ata1: EH complete
Jan 19 15:20:56 MainStore kernel: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 19 15:20:56 MainStore kernel: ata2.00: configured for UDMA/133
Jan 19 15:20:56 MainStore kernel: ata2: EH complete
Jan 19 15:20:56 MainStore kernel: sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 19 15:20:56 MainStore kernel: ata3.00: configured for UDMA/133
Jan 19 15:20:56 MainStore kernel: ata3: EH complete
Jan 19 15:20:56 MainStore kernel: sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 19 15:20:56 MainStore kernel: ata4.00: configured for UDMA/133
Jan 19 15:20:56 MainStore kernel: ata4: EH complete
Jan 19 15:20:56 MainStore kernel: sd 3:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 19 15:20:56 MainStore kernel: ata5.00: configured for UDMA/133
Jan 19 15:20:56 MainStore kernel: ata5: EH complete
Jan 19 15:20:56 MainStore kernel: sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Jan 19 21:20:21 MainStore kernel: ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
Jan 19 21:20:21 MainStore kernel: ata4.00: failed command: FLUSH CACHE EXT
Jan 19 21:20:21 MainStore kernel: ata4.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 0
Jan 19 21:20:21 MainStore kernel: res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
Jan 19 21:20:21 MainStore kernel: ata4.00: status: { DRDY }
Jan 19 21:20:21 MainStore kernel: ata4: hard resetting link
Jan 19 21:20:22 MainStore kernel: ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Jan 19 21:20:22 MainStore kernel: ata4.00: configured for UDMA/133
Jan 19 21:20:22 MainStore kernel: ata4.00: retrying FLUSH 0xea Emask 0x4
Jan 19 21:20:22 MainStore kernel: ata4.00: device reported invalid CHS sector 0
Jan 19 21:20:22 MainStore kernel: ata4: EH complete
Jan 19 21:32:24 MainStore kernel: ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
Jan 19 21:32:24 MainStore kernel: ata4.00: failed command: FLUSH CACHE EXT
Jan 19 21:32:24 MainStore kernel: ata4.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 0
Jan 19 21:32:24 MainStore kernel: res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
Jan 19 21:32:24 MainStore kernel: ata4.00: status: { DRDY }
Note that one of my Seagate disks (ata4/sd3) froze at 21:20. This would not of occured had disk-write cache not been magically turned back on. - ScouserAspirantI discovered that the following truns write cache-off:
# hdparm -W0 /dev/sdd
/dev/sdd:
setting drive write-caching to 0 (off)
write-caching = 0 (off)
# hdparm -W0 /dev/sde
/dev/sde:
setting drive write-caching to 0 (off)
write-caching = 0 (off)
Use -W0 turn it off and -W1 to turn it on. (see /frontview/bin/diskcache for more detail).
But I am trying to understand /etc/default/hdparm and /etc/hdparm.conf
I think the answer lies with these files. - ScouserAspirantI wrote this script to turn manipulate the write-cache for anyone interested.
#!/bin/bash
# Disk write-cache utility for ReadyNAS
# By B Goodheart Jan 2012
# V 1.0
# Check we're running as a privileged user
if [ $(id -u) -ne 0 ]
then
echo "$0: insufficent permissions"
exit 2
fi
usage () {
echo "Usage: $0 [-qh] [0|1|on|off|status] [/dev/??]"
cat << USAGE
A utility for manipulating and querying the write-cache feature for attached disk drives.
Arguments are as follows:
-q quite mode
-h prints help and usage information
0 or on turn write-cache off for all disks or a specified disk
1 or off turn write-cache on for all disks or a specified disk
status prints current status of all disks or a specified disk
/dev/?? execute this command for the specified disk only
CONDITIONS:
1) No arguments given is the same as specifying argument "status"
2) User must have root privileges to execute this command
3) If no disk argument is specified, this command will process execution for ALL disks
4) This command does not process USB attached disks
USAGE
}
checkdev() {
if [ ! -e $1 ]
then
echo "$1: no such device"
exit 1
fi
}
status () {
disk=$1
# read the write-cache status for all attached disks in the ReadyNAS disk enclosure
if [ "$disk" = "all" ]
then
for i in /sys/block/[hs]d?; do
# ignore USB connected disks
readlink $i | grep -q usb && continue
dev="/dev/`basename $i`"
echo "${dev}: `/sbin/hdparm -W ${dev} | grep caching`"
done
else
readlink $disk | grep -q usb && return
checkdev ${disk}
echo "${disk}: `/sbin/hdparm -W ${disk} | grep caching`"
fi
}
process () {
state=$1
disk=$2
qflag=$3
if [ "$disk" = "all" ]
then
for i in /sys/block/[hs]d?; do
# ignore USB connected disks
readlink $i | grep -q usb && continue
dev="/dev/`basename $i`"
/sbin/hdparm -${qflag}W${state} ${dev}
#echo "/sbin/hdparm -${qflag}W${state} ${dev}"
done
else
readlink $disk | grep -q usb && return
checkdev ${disk}
/sbin/hdparm -${qflag}W${state} ${disk}
#echo "/sbin/hdparm -${qflag}W${state} ${disk}"
fi
/usr/bin/update_disk_info_cache
}
device="all"
if [ $# = 0 ]
then
status $device
exit 0
fi
quiet=""
while getopts qh opt
do
case "$opt" in
q)
quiet="q"
shift
;;
h|\?)
usage
exit 0
;;
esac
done
#if [ "$1" = "-q" ]
#then
# quiet="q"
# shift
#fi
if [ $# = 2 ]
then
device=$2
fi
case "$1" in
0|1)
process $1 $device $quiet
;;
on)
process 1 $device $quiet
;;
off)
process 0 $device $quiet
;;
status)
status $device
;;
*)
usage
exit 1
;;
esac
exit 0
Examples:
Query the write cache status for all disks:MainStore:~# hdwritecache
/dev/sda: write-caching = 1 (on)
/dev/sdb: write-caching = 1 (on)
/dev/sdc: write-caching = 1 (on)
/dev/sdd: write-caching = 0 (off)
/dev/sde: write-caching = 0 (off)
Query the write cache for a specified disk:MainStore:~# hdwritecache status /dev/sdd
/dev/sdd: write-caching = 0 (off)
Turn the write cache off for all disks quietly:MainStore:~# hdwritecache -q 0
MainStore:~# hdwritecache
/dev/sda: write-caching = 0 (off)
/dev/sdb: write-caching = 0 (off)
/dev/sdc: write-caching = 0 (off)
/dev/sdd: write-caching = 0 (off)
Turn the write cache on for /dev/sdc:MainStore:~# hdwritecache 1 /dev/sdc
/dev/sdc:
setting drive write-caching to 1 (on)
write-caching = 1 (on)
MainStore:~# hdwritecache
/dev/sda: write-caching = 0 (off)
/dev/sdb: write-caching = 0 (off)
/dev/sdc: write-caching = 1 (on)
/dev/sdd: write-caching = 0 (off) - szleviAspirantWow, one week and nobody from Netgear/ReadyNAS gives a crap about your very detailed problem description... OS support must be sucking around here.
This issue just gave me the idea to see if my problem - viewtopic.php?f=23&t=60670 - will disappear if I turn caching off on my Pro 6... - ScouserAspirantThanks for your comment and support slevi but this is Forum is user run as far as I know and is not an official Netgear or ReadyNas support tool. Any answers, comments or suggestions as far as I understand it are voluntarily given up by forum users. The proper method of logging a support problem is via a support request ticket off their support page. Albeit, I have not had any joy going down that avenue.
I guess the first thing to ask you is do you have Seagate disks? if so what model and rev are they? If they are the 1Gb or 1,5Gb disks I would put bets on that your problem is the same as mine. Turn write-cache off and bingo! your problem has gone.
Keep me posted.
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!