In this How To I am going to cover basic preclear_disk.sh 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 preclear_disk.sh is located bottom of
this post (
direct link) <- you will only be able to download the preclear_disk.sh if you have a free account on the unRAID forums.
First, the reasons to use preclear_disk.sh 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 preclear_disk.sh from the link above. From there copy preclear_disk.sh 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 preclear_disk.sh 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 preclear_disk.sh!!
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 preclear_disk.sh 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 preclear_disk.sh that you can view and look through by typing:
/boot/preclear_disk.sh -?
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/preclear_disk.sh -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 preclear_disk.sh on it.
Now pick the drive you want to preclear from the ones listed by the above command and type:
/boot/preclear_disk.sh -A /dev/hdb
OR
/boot/preclear_disk.sh -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 preclear_disk.sh script does its thing.
Here it is on step 2 of 10
There are 10 steps to the preclear_disk.sh 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 preclear_disk.sh 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 preclear_disk.sh. 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
preclear_disk.sh results thread.
Now for a few notes on preclear_disk.sh:
1. If you start a preclear_disk.sh 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 preclear_disk.sh 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/preclear_disk.sh -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.