What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

USB External HD Write Cache Question

SaBl

Occasional Visitor
I have an external NTFS formatted Western Digital hard drive connected to the router. Both the router and the hard drive are connected to a UPS so there's no problem if the power goes out. However, I was in the middle of copying a text file to the drive when the router rebooted itself. From searching online the only thing I could find is some vague info that the n66u will sometimes reboot if being accessed from the external ip address or something. I know I had another family member using the internet at the time but I'm not sure what they were doing, I think just browsing and possibly chatting. First time this has happened.

When all connections were restored and the router mounted the drive, the text file showed as a 0kb file. I then recopied the file, however I decided that I should probably unmount the drive and connect it to my computer to run chkdsk on it. Sure enough, Windows (7) said if I wanted to scan and fix errors on the drive. Basically chkdsk restored another text file that I had delete right before copying the new text file. The restored file was in a hidden found.000 folder at the root of the drive. Chkdsk then deleted the new text file that I had recopied. lol. No biggie, I just recopied it again.

Now, according to the sdparm utility, the hard drive has write cache enable. No biggie, since there's no danger from power outages however I'm concerned about data loss if the router randomly decides to reboot. Unfortunately the sdparm command to disable write cache does not work.

To check if it's enabled:
sdparm -6 -g WCE /dev/sda (or whatever your drive letter is )

To disable, the command should be:
sdparm -6 -s WCE=0 /dev/sda

Write cache however is still enabled. Not sure what else to do. Any idea why the command isn't working? Anyone have any rebooting problems? Or are they fairly rare? I suppose it's not as big a deal if I'm copying files from my computer to the drive but it's different if I'm downloading files from the internet directly to the drive. It'd be nice if the system log could give an indication as to what causes the reboot but the log is reset after every reboot.

As a side note, the stock firmware doesn't have option for spinning down the drive after being idle for a period of time, so before I go to bed I use
sdparm -v -C stop /dev/sda
and the router will spin down the drive. It will start up again when you access a new file you didn't access before or when you restart your computer and access your drive. So for those of you that don't want your drive on 24/7 this command is nice solution. Not automatic, but still.
 
Last edited:
Ok, I have now pinpointed the cause of reboot, very strange and I'm not sure why it happens, but the text file that I was writing was a .reg file, I was exporting registry key from my xp machine so I wouldn't have to retype them in the future. In the process of exporting the router crashes. I exported the same key and bam, router reboot again. Very strange indeed. But at least I know what to avoid now lol. Best to export locally to a file and then copy that file over to the network drive.
 
The reboot issue you are referring to can usually be resolved by having GRO disabled under LAN -> Switch Control. If it was forced disabled, then the reboot was caused by something else.

Keep in mind that USB enclosures don't always pass the full ATA command set to the hard disk. The implementation will vary based on the host controler used in the enclosure.

Write cache isn't a problem in case of reboot, because the hard disk is still powered on, therefore its firmware can still flush its cache. Your problem is more likely to occur from filesystem/OS level cacheing.

NTFS can be fairly resistant to such interruptions since it's a journaling filesystem, however the NTFS support under Linux is the result of reverse engineering, and therefore might not be as reliable as the native implementation found under Windows. If you are worried about reliability, then I would recommend switching to a native Linux filesystem.
 
Thanks RMerlin. I checked the setting and it shows
Disable GRO(Generic Receive Offload) Set to Yes
So since it's disabled I'm assuming it's something else. I'm not too sure how exporting a registry key is much different than writing a regular file but networking can be rather finicky. And that makes sense about the enclosure, didn't think about that. As far as the filesystem, running chkdsk tended to be counterproductive in this particular case. The router uses an ntfs driver by Paragon, they usually make good stuff, but of course no implementation will match native, although Tuxera seems to think otherwise.

Btw I've read good things about your firmware, maybe I'll give it a go one of these days.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top