Page 1 of 1

scrub ?!?

Posted: 30 Jun 2015 20:22
by seller
Hi
weiss jemand wie lange ein SCRUB bei 4 2 TB Platten braucht und kann ich weiterarbeiten beim scrub oder nicht?
was passiert wenn das NAs während des Scrub heruntergefahren wird? darf man das ?

gruß
Seller

Re: scrub ?!?

Posted: 30 Jun 2015 20:29
by Princo
Es kommt darauf an, wie voll das Array ist. Bei 3x3TB (gut gefüllt) kann man mit 8h rechnen.
Bei dir wird es wahrscheinlich schneller gehen.
Während des Scrubs kannst du normal weiterarbeiten.
Du kannst sogar das NAS herunterfahren, der Scrub macht dann nach einem Neustart weiter.

Grüße
Princo

Re: scrub ?!?

Posted: 01 Jul 2015 05:41
by seller
Hallo Princo,
vielen Dank für die Hilfestellung
gruß
Seller

Re: scrub ?!?

Posted: 01 Jul 2015 17:40
by seller
so habe heute morgen das scrub angeschubst so gegen 5:00 Uhr
heute Nachmitteg so gegen 17:00 Uhr geschaut Nas zeigte keine besonderen Aktivitäten, jetzt weiss ich nicht ob der Scrub gelaufen ist.
Im LOG steht nur:
Jul 1 02:44:43 nas4free-2 root: zpool scrub NAS

Stimmt es dass Scrub nur Meldungen ausgibt wenn was schief läuft?

Gruß
Seller

Re: scrub ?!?

Posted: 01 Jul 2015 18:03
by crowi
schau mal unter: Disks|ZFS|Pools|Information
da sollte dann sowas wie:
state: ONLINE
scan: scrub repaired 0 in 1h49m with 0 errors on Wed Jun 24 15:34:21 2015
stehen...

Re: scrub ?!?

Posted: 01 Jul 2015 18:41
by seller
Hallo Crowl,
ja habs gefunden .
JUHU!!!!!!!!!!!!!!!!!!!!!!!!!!! keine Fehler!

pool: NAS
state: ONLINE
scan: scrub repaired 0 in 9h23m with 0 errors on Wed Jul 1 12:08:30 2015
config:

NAME STATE READ WRITE CKSUM
NAS ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ada1.nop ONLINE 0 0 0
ada0 ONLINE 0 0 0
ada2.nop ONLINE 0 0 0
ada3.nop ONLINE 0 0 0

errors: No known data errors

Danke
Gruß
Seller

Re: scrub ?!?

Posted: 01 Jul 2015 19:44
by seller
was haltet Ihr von dem Script: scrubPools.sh?
kann man das verwenden und mit nem cronjob einbinden?
oder ist das nicht mehr aktuell?

Gruß
Seller

Code: Select all

#!/bin/sh
#############################################################################
# Script aimed at scrubing all zpools in order to find checksum errors
#
# Author: fritz from NAS4Free forum
#
#############################################################################

# Initialization of the script name
readonly SCRIPT_NAME=`basename $0` 		# The name of this file

# set script path as working directory
cd "`dirname $0`"

# Import required scripts
. "config.sh"
. "common/commonLogFcts.sh"
. "common/commonMailFcts.sh"
. "common/commonLockFcts.sh"

# Record the timestamp corresponding to the start of the script execution
readonly START_TIMESTAMP=`$BIN_DATE +"%s"`

# Initialization of the constants 
readonly LOGFILE="$CFG_LOG_FOLDER/$SCRIPT_NAME.log"
readonly TMPFILE_ARGS="$CFG_TMP_FOLDER/$SCRIPT_NAME.$$.args.tmp"

# Set variables corresponding to the input parameters
ARGUMENTS="$@"


################################## 
# Check script input parameters
#
# Params: all parameters of the shell script
# return : 1 if an error occured, 0 otherwise 
##################################
parseInputParams() {
	local opt
	
	# parse the optional parameters
	# (there should be none)
	while getopts ":" opt; do
        	case $opt in
			\?)
				echo "Invalid option: -$OPTARG"
				return 1 ;;
        	esac
	done

	# Remove the optional arguments parsed above.
	shift $((OPTIND-1))
	
	# Check if the number of mandatory parameters 
	# provided is as expected 
	if [ "$#" -ne "0" ]; then
		echo "No mandatory arguments should be provided"
		return 1
	fi
	
	return 0
}

##################################
# Check if scrubing is still in progress for a given pool
# Return : 0 if scrub is in progress,
#	   1 otherwise
##################################
scrubInProgress() {
	if $BIN_ZPOOL status | grep "scrub in progress">/dev/null; then
		return 0
	else
		return 1
	fi
}

##################################
# Scrub all pools
# Return : 0 no problem detected
#	   1 problem detected
##################################
main() {

	# Starting scrubbing
	log_info "$LOGFILE" "Starting srubbing" 
	$BIN_ZPOOL list -H -o name | while read pool; do
		$BIN_ZPOOL scrub $pool
		log_info "$LOGFILE" "Starting srubbing of pool: $pool" 
	done

	# Waiting for the end of the scrubbing
	while scrubInProgress; do sleep 10; done;
	log_info "$LOGFILE" "Scrub finished for all pools" 

	# Check if the pools are healthy
	if $BIN_ZPOOL status -x | grep "all pools are healthy">/dev/null; then
		$BIN_ZPOOL status -x | log_info "$LOGFILE"
		return 0
	else
		$BIN_ZPOOL status | log_error "$LOGFILE"
		return 1
	fi
}



# Parse and validate the input parameters
if ! parseInputParams $ARGUMENTS > "$TMPFILE_ARGS"; then
	log_info "$LOGFILE" "-------------------------------------"
	cat "$TMPFILE_ARGS" | log_error "$LOGFILE"
	get_log_entries_ts "$LOGFILE" "$START_TIMESTAMP" | sendMail "$SCRIPT_NAME : Invalid arguments"
else
	log_info "$LOGFILE" "-------------------------------------"
	cat "$TMPFILE_ARGS" | log_info "$LOGFILE"

	# run script if possible (lock not existing)
	run_main "$LOGFILE" "$SCRIPT_NAME"
	# in case of error, send mail with extract of log file
	[ "$?" -eq "2" ] && get_log_entries_ts "$LOGFILE" "$START_TIMESTAMP" | sendMail "$SCRIPT_NAME : issue occured during execution"
fi

$BIN_RM "$TMPFILE_ARGS"
exit 0


Re: scrub ?!?

Posted: 03 Jul 2015 01:08
by Princo
seller wrote:was haltet Ihr von dem Script: scrubPools.sh?
kann man das verwenden und mit nem cronjob einbinden?
oder ist das nicht mehr aktuell?
scrubPools.sh ist Bestandteil einer ganzen Tool-Sammlung des Forenmitglieds fritz: viewtopic.php?f=70&t=2197
scrubPools.sh ist sinnvoll, wenn man auch andere Tools aus dieser Sammlung nutzt.

Ich nutze z.B. das Tool manageAcpi.sh, welches mein NAS herunterfährt, wenn keiner meiner Rechner mehr eingeschaltet ist.
Wenn man dann scrubPools.sh einsetzt, dann "weiß" manageAcpi.sh, daß es das NAS nicht herunterfahren soll, während der Scrub läuft.
Das ist echt praktisch.

Wenn man manageAcpi.sh nicht einsetzt, dann braucht man den Scrub-Lauf auch nicht über scrubPools.sh starten.
Dann würde auch ein simpler Cronjob mit "/sbin/zpool scrub $Poolname" ausreichen.

Grüße
Princo