UNIX Hints & Hacks

ContentsIndex

Chapter 1: Topics in Administration

 

Previous ChapterNext Chapter

Sections in this Chapter:

1.1 Collecting System Information

 

1.7 Swap on-the-Fly

 

1.13 Remove the ---- Dashes ----

1.2 Backup Key Files!

 

1.8 Keep It Up with nohup

 

1.14 echo Does ls

1.3 Execution on the Last Day of a Month

 

1.9 Redirecting Output to Null

 

1.15 Building Large Dummy Files

1.4 Dealing with Unwanted Daemons

 

1.10 Keeping Remote Users Out

 

1.16 Burning-in Disk Drives

1.5 Keep Those Daemons Running

 

1.11 Rewinding Tapes Fast

 

1.17 Bringing a System Down

1.6 fuser Instead of ps

1.12 Generating a Range of Numbers

 

 

1.16 Burning-in Disk Drives

1.16.1 Description

1.16.1 Description

There are various burn-in methods for testing new drives. These include creating a very large file and then coping it a number times in an endless loop in various ways.

Example One: Deal the File Out

Flavors: AT&T, BSD

Shells: bsh, ksh

Syntax:

burndeal [filename] [fsname] [fsname] [fsname]

In this method, one single very large file from the same disk, partition, or volume group will be copied out to the same or other filesystems. The file is dealt out to multiple filesystems.

#! /bin/sh
BIGFILE="$1" LIST="$2 $3 $4" while [ 1 ] do for area in $LIST do echo "Copy $BIGFILE to $area/$BIGFILE" cp $BIGFILE $area/$BIGFILE done done

Line 1: Define the shell.

Line 3: Get the name of the large file being passed.

Line 4: Get the filesystems to copy into.

Line 5: Begin the endless loop.

Line 7: Begin progressing through the list of filesystems to repeatedly copy into.

Line 8: Display the current status of the files being copied.

Line 9: Copy the large file into the filesystem.

The script gets passed a large file and copies it over and over, endlessly, to three predefined filesystems, until a Control-C is hit. A minor change in line 4 can allow more or fewer filesystems to be defined, if preferred.

# burndeal 100megs /disk1 /disk2 /disk3
Copy 100megs to /disk1/100megs
Copy 100megs to /disk2/100megs
Copy 100megs to /disk3/100megs
Copy 100megs to /disk1/100megs
Copy 100megs to /disk2/100megs
<CTRL -C>

Example Two: Round-Robin

Flavors: AT&T, BSD

Shells: sh, ksh

Syntax:

burnrobin [filename] [fsname] [fsname] [fsname]

In this method, the large file is copied from filesystem to filesystem as in example one, but the file is not copied from one single filesystem. It is copied from the previous filesystem that it was copied into. Are you confused yet? It will all make more sense when I explain the script.

#! /bin/sh
BIGFILE="$1" TMP="$BIGFILE" LIST="$2 $3 $4"
while [ 1 ] do for area in $LIST do echo "Copy $BIGFILE to $area/$BIGFILE" cp $TMP $area/$BIGFILE TMP="$area/$FILE" done done

Line 1: Define the shell.

Line 3: Get the name of the large file being passed.

Line 4: Get the temporary file that will be copied.

Line 5: Get the filesystems to copy into.

Line 7: Begin the endless loop.

Line 9: Begin progressing through the list of filesystems to repeatedly copy into.

Line 11: Display the current status of the files being copied.

Line 12: Copy the large file from the previous filesystem into the current filesystem.

Line 13: The file just copied into the current filesystem will be the new location for the file to be copied from in the next loop.

The script gets passed a large file and copies it over and over, endlessly to and from one filesystem to another until a Control-C is hit. More or fewer filesystems can be defined if preferred:

# burnrobin 100megs /disk1 /disk2 /disk3
Copy 100megs to /disk1/100megs
Copy /disk1/100megs to /disk2/100megs
Copy /disk2/100megs to /disk3/100megs
Copy /disk3/100megs to /disk1/100megs
Copy /disk1/100megs to /disk2/100megs
<CTRL -C>

Example Three: Fill the Disk

Flavors: AT&T, BSD

Shells: sh, ksh

Syntax:

burnfill [filename] [number]

When burning in disks, you might want to fill the entire disk up. This is also good when your new system has a tape subsystem and backup software that will need to be tested as well.

#! /bin/sh
BIGFILE="$1" NUMBER=$2 COUNT=0 while [ $COUNT -lt $NUMBER ] do echo "Copy $BIGFILE to $BIGFILE.$COUNT" cp $BIGFILE $BIGFILE.$COUNT COUNT=`expr $COUNT + 1` done

Line 1: Define the shell.

Line 3: Get the name of the large file being passed.

Line 4: Get the number of times to be copied.

Line 5: Start the current number of times that copies have been made to 0.

Line 6: While the number of times the file has been copied is fewer than the number of times it needs to be copied, keep making copies of the file.

Line 8: Display the current status of the copies.

Line 9: Copy the large file into a new filename.

Line 10: Increment the number of copies that have been made by one.

The script gets passed a large file and the number of copies you want to make of the file in the same filesystem. You must do some calculating so that you don't risk filling up the disk drive you are burning in. Use the formula:

Total Number = Total Disk Space / Size of Large File

# burnfill 100megs 5
Copy bigfile to bigfile.0
Copy bigfile to bigfile.1
Copy bigfile to bigfile.2
Copy bigfile to bigfile.3
Copy bigfile to bigfile.4
Copy bigfile to bigfile.5

Depending on the filesystem involved, you might want to overload the disks to test what will happen. Because you are doing this in a nonproduction environment, now is the time to play and test, when everything is still under support by the vendors.

You can adapt example one and two into this script with the endless loop feature. If you suspect the disk will fill up fast, you won't have to keep restarting the script.

Reason

Burning in new equipment should always be finished before any new system goes into a production environment. During a burn-in phase, if there's a problem, the disk drives will usually be the first to fail.

Real Word Experiences

In the never-ending quest for more time, the easiest and quickest way to burn in a disk is to send it a series of reads and writes. There are many system configurations, and they can all be different, with large drives, small drives, multiple partitions, striped drives, volume groups, and raid arrays. Different techniques can be used for burning in your storage devices. You have to decide what will work best for your configuration.

UNIX Hints & Hacks

ContentsIndex

Chapter 1: Topics in Administration

 

Previous ChapterNext Chapter

Sections in this Chapter:

1.1 Collecting System Information

 

1.7 Swap on-the-Fly

 

1.13 Remove the ---- Dashes ----

1.2 Backup Key Files!

 

1.8 Keep It Up with nohup

 

1.14 echo Does ls

1.3 Execution on the Last Day of a Month

 

1.9 Redirecting Output to Null

 

1.15 Building Large Dummy Files

1.4 Dealing with Unwanted Daemons

 

1.10 Keeping Remote Users Out

 

1.16 Burning-in Disk Drives

1.5 Keep Those Daemons Running

 

1.11 Rewinding Tapes Fast

 

1.17 Bringing a System Down

1.6 fuser Instead of ps

1.12 Generating a Range of Numbers

 

 

© Copyright Macmillan USA. All rights reserved.