immense delayed write to file system (ZFS and UFS2), performance issues

Adrian Wontroba aw1 at stade.co.uk
Tue Jan 26 23:55:01 UTC 2010


On Wed, Jan 27, 2010 at 01:15:17AM +0200, Dan Naumov wrote:
> Can anyone confirm that using the WDIDLE3 utility on the 2TB WD20EADS
> discs will not cause any issues if these disks are part of a ZFS
> mirror pool? I do have backups of data, but I would rather not spend
> the time rebuilding the entire system and restoring enormous amounts
> of data over a 100mbit network unless I absolutely have to :)

How about using the "write every 5 seconds" python script posted earlier
in this thread by erik at tefre.com? Works nicely for me and stops the load
cycle count increase.

Thank you Erik!

To save searching, here is Erik's script as used here.

#!/usr/local/bin/python
# Author: Erik Stian Tefre <erik at tefre.com>
#Keeping this python script running prevents Load_Cycle_Count from
#incrementing on my WD15EADS drives by forcing a write every 5 seconds (2
#drive zfs mirror pool, average of 2 load cycles per minute when the
#script is not running):

import time,os

mypool = "/tank"
#         ^^ Change to your pool!

fname = os.path.join(mypool, "wd_green_anti_idle.pyfile")
c = 0
f = open(fname, "w")

while True:
        if c == 100:
                f.close()
                f = open(fname, "w")
                c = 0
        c += 1
        time.sleep(5)
        f.write("a")
        f.flush()
        os.fsync(f.fileno())

You might find this handy too:

#!/bin/sh
# $FreeBSD:$

# PROVIDE: wd_green_anti_idle
# REQUIRE: LOGIN

. /etc/rc.subr

wd_green_anti_idle_enable="${wd_green_anti_idle_enable-NO}"

name=wd_green_anti_idle
rcvar=`set_rcvar`
command="/usr/local/stade/bin/wd_green_anti_idle.py"
start_cmd="wd_green_anti_idle_start"

wd_green_anti_idle_start()
{
    if ! checkyesno wd_green_anti_idle_enable ; then
	return 0
    fi
    echo "Starting ${name}."
    ${command} &
}

load_rc_config $name
run_rc_command $*

Adjust command name to suit, put in /usr/local/etc/rc.d, add
wd_green_anti_idle_enable="YES" to /etc/rc.conf and the script starts
running during startup. A minor bug - it doesn't close down.

-- 
Adrian Wontroba
A witty saying proves nothing, but saying something pointless gets
people's attention.


More information about the freebsd-stable mailing list