Sunday, February 20, 2011

How To preclear your hard drives for use in your unRAID servers

In this How To I am going to cover basic usage and why you should use it on every disk before adding it to your unRAID array.

First and formost I would like to thank Joe L. of the unRAID forums.  All credit goes to him for this hard drive testing and clearing utility.
The newest version of is located bottom of this post (direct link) <- you will only be able to download the if you have a free account on the unRAID forums.

First, the reasons to use and my attempt to clear up some confusion.
If you are just setting up a new unRAID server I suggest using the most current stable version which as of this writing is unRAID 4.7. There is one setting that needs to be changed on the Settings page of unRAID that will be of benefit for any drives that are added to your unRAID server from this point forward.

On the Settings page go to the "Disk Settings" section and set "Default partition format" to "MBR: 4K-aligned"

OK, now that that is cleared up I can move on to the real meat of this post.
First I suggest downloading the newest version of the from the link above.  From there copy to the flash drive of you server.  You can do this by shutting down the unRAID server, pulling the flash drive, and then transferring the file over to it.  Then you can move the flash drive back to the unRAID server and boot it back up.  You can also transfer the file to the flash drive over the network.  You can connect to the share so long as you have it set to "Export Read/Write" on the "Shares" page on the unRAID webGUI.  Once you are connected to the share just copy the file over.

Once the file is on the flash drive and the server is up and running you are ready to use!!

There are a couple of different ways to run preclear but for the sake of keeping things simple to start I will limit this post to one way.  (Look for the other ways to run in later posts!!)
For this post I will describe how to run preclear through a telnet session.  If you are using a Windows computer I suggest downloading PuTTY (documentation), if you are using a Mac then you can use Terminal (located in the Applications/Utilities folder).

Once you are ready you will need to telnet into the unRAID server.  From your computer open Terminal/PuTTY and type "telnet IP_ADDRESS_OF_SERVER" to connect to the unRAID server.  It will ask you for a password, just hit enter, then it will ask for a login, just type "root" to get to the command prompt where it reads "root@Tower:~#".

There are many many options for that you can view and look through by typing:
/boot/ -?
You will not need to use all of these options and I will cover the ones that need to be used for a new unRAID setup based on version 4.7.

Now type:
/boot/ -l
You will see an output of something similar to this that will list all the disks that are able to be precleared:

So now that we have the listing of the drives that are available for clearing we can proceed.  From this point forward you will need to make sure that you are about to clear the drive you actually want to clear!!  If there are any drives not in the array they will be listed by using the above command and you have the potential to wipe ALL DATA off the drive should you use on it.

Now pick the drive you want to preclear from the ones listed by the above command and type:
/boot/ -A /dev/hdb
/boot/ -a /dev/hdb
The difference between the -A and -a switch is in regard to how the drive is set up for use in unRAID.  For version 4.7 and later (including version 5.0-beta3 and later) you will want to use the -A option for all drives EXCEPT for Western Digital Green drives that have a jumper installed on pins 7 and 8 (if the drives are Western Digital Green drives with a jumper then use the -a option instead).
The hdb part will be different depending on your server configuration.  It could be hda, hdb, hdc,... or sda, sdb, sdc,...
If the -A or -a option is left off the above command will use the default setting of the "Default partition format" from above. "MBR: 4K aligned" is the same as using the -A option, and "MBR: unaligned" is the same as using the -a option.

The above commands will run the preclear for 1 complete pass on a drive.  For a 2TB drive this can take 25+ hours to complete. When you run the above command you should end up with a screen similar to this:

You will need to answer "Yes" (Capital Y and lowercase es).

After you answer Yes you will be presented with a screen that looks like this:

This screen will update as the progress of the script does its thing.

Here it is on step 2 of 10

There are 10 steps to the process and below is the script on the final step:

After the script is finished you will get a screen that looks something like this:

One of the benefits of using this newest version of is the "preclear_reports" folder that it creates on the flash drive.  Inside that folder is the start report, finish report, and final report produced by  The final report will be what you need to look at to understand the health of your drive.  It is much more understandable for new and inexperienced users.  If you do have any questions about the final report feel free to post the file in the results thread.

Now for a few notes on
1. If you start a session via the above instructions you will need to disable any settings on your Windows or Mac computer that would make it go to sleep/hibernate.  You can leave the screen saver enabled but the Windows/Mac machine must not be allowed to sleep/hibernate.  If it is allowed to sleep/hibernate then the task that is running will be cancelled.
2. It is not necessary to use preclear on a drive but it does thoroughly test the drive to make sure it is working properly.
3. If you do not preclear the drive the unRAID array will be offline during its clearing process, meaning you can not get to your media files, for as long as it takes the drive to be cleared by unRAID itself (that could be 8+ hours).
4. There is a "-c" option that will clear a drive for a certain number of cycles.  If you wanted to clear the drive 3 times one right after the other you could type this:
/boot/ -A -c 3 /dev/hdb
5. There are many more options that can be specified and used though I will not go into them for this post.

And last but not least a few warnings:
1. This utility is not supported by Tom at Lime-Technology.
2. It is possible for you to clear a disk you did not intend...(if you have multiple disks that have data installed in your server, but they are not assigned to your array, and you want to clear one, but not the other, and you give the wrong device, it will be the wrong disk cleared...  If you do, sorry... I tried to protect you from yourself.  Do be careful.

No comments:

Post a Comment