Jump to content
ideaman924

(SOLVED) Set write cache permanently?

10 posts in this topic Last Reply

Recommended Posts

Posted (edited)

Hi all. When I reboot my server all four of my drives come up with disabled write cache. They're the WD RE 2TB ones. Running 

hdparm -W 1 /dev/sd<value>

fixes the problem but only until the next reboot.

 

Do I just set those lines in the go file? Won't the values change across reboots? How do I get them to enable every time I start up the server? Thanks.

derrickserver-diagnostics-20190521-1151.zip

Edited by ideaman924

Share this post


Link to post

Look into User Scripts plugin, create a new one, and set it to start at Array Startup.

Share this post


Link to post
16 minutes ago, BRiT said:

Look into User Scripts plugin, create a new one, and set it to start at Array Startup.

What about the changing values for /dev/sda, /dev/sdb...?

Share this post


Link to post
15 minutes ago, ideaman924 said:

What about the changing values for /dev/sda, /dev/sdb...?

Instead of using the /dev/sdX way to specify the drive you could instead use the /dev/disk/by-id method as that never changes across boots..   Opening a terminal window and doing 

  ls /dev/disk/by-id/

would allow you to see all the id's - you should be able to identify the one you want by the serial number.

Share this post


Link to post

Or just set all the drives. This should be a good for everything setting, right?

Share this post


Link to post
On 5/21/2019 at 8:30 PM, itimpi said:

Instead of using the /dev/sdX way to specify the drive you could instead use the /dev/disk/by-id method as that never changes across boots..   Opening a terminal window and doing 

  ls /dev/disk/by-id/

would allow you to see all the id's - you should be able to identify the one you want by the serial number.

Thank you for the tip! Script works like a charm.

Share this post


Link to post

For anyone who needs the script here it is:

 

#!/bin/bash

# Drives
declare -a StringArray=("ata-WDC_WD2003FYYS-70W080_WJUN0123456" "DRIVE2" "DRIVE3" "DRIVE4")

# Show status
echo "Current drive status: "
for drive in ${StringArray[@]}; do
    hdparm -W /dev/disk/by-id/$drive
done

# Enable write caching
for drive in ${StringArray[@]}; do
    hdparm -W 1 /dev/disk/by-id/$drive
done

# Show status again
echo "Finished running, check if the write cache was enabled!"
for drive in ${StringArray[@]}; do
    hdparm -W /dev/disk/by-id/$drive
done

Replace the serial codes in the StringArray and you should be good to go! Pop it in User Scripts.

Share this post


Link to post
On 5/23/2019 at 1:58 AM, ideaman924 said:

For anyone who needs the script here it is:

 


#!/bin/bash

# Drives
declare -a StringArray=("ata-WDC_WD2003FYYS-70W080_WJUN0123456" "DRIVE2" "DRIVE3" "DRIVE4")

# Show status
echo "Current drive status: "
for drive in ${StringArray[@]}; do
    hdparm -W /dev/disk/by-id/$drive
done

# Enable write caching
for drive in ${StringArray[@]}; do
    hdparm -W 1 /dev/disk/by-id/$drive
done

# Show status again
echo "Finished running, check if the write cache was enabled!"
for drive in ${StringArray[@]}; do
    hdparm -W /dev/disk/by-id/$drive
done

Replace the serial codes in the StringArray and you should be good to go! Pop it in User Scripts.

Thanks

Enabling write cache manually worked but the changes were not persistent through reboots on AMD server.

 

Working perfectly now.

 

Share this post


Link to post

Gutted didnt work for me, still showing as disabled when I run it!, crazy thing is, copying between the same drives outside of the array speeds hit max, within...40mb :(:(:(

Share this post


Link to post

Ok, googlefu...changed the NCQ of the array drives from 1 to 31 and speed has increased dramatically, doing a clear on 2 drives, gone from 38mb/s to 130mb/s as soon as I made the change, I am a happy camper!, I was about to hit the go button on another HBA controller!

 

Command to change your NCQ level is echo 31 > /sys/block/sdX/device/queue_depth  sdX is your device, echo XX is the level you want to change to

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.