Preclear plugin


3042 posts in this topic Last Reply

Recommended Posts

  • Replies 3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hi guys, this is a simple plugin that allows users to clear their disks before add them to the array.   The main characteristics of this plugin are: Modularity: can be used standalon

I think Thanks should be directed at all those members that have been dealing with the mess the last few months. @dlandon and @Squid have been working behind the scenes to try and clean up, and o

Dontlookoverthere over on the unRAID subreddit figured out how to get the plugin running again with a simple edit to the plg:   https://www.reddit.com/r/unRAID/comments/7wjpus/preclear_worki

Posted Images

I installed the beta plugin from here:

 

http://lime-technology.com/forum/index.php?topic=39985.msg453938#msg453938

 

But it doesn't show up under settings---user utilities.

 

Can someone tell me where it is?

 

This is on my test server which was recently updated from 6.1.9 to 6.2.0 RC2

 

Moved from Settings to Tools > Disk Utilities > Preclear Beta

Link to post

I'm using Unraid 6.2-rc2 and the Preclear Disks Beta plugin version 2016.06.23.

 

When I run a clear using the plugin, it starts for a 4 or 5 seconds and then ends and says "Preclear finished successfully" but obviously it hasn't.

Here's what the plugin window looks like. There are some suspicious lines towards the bottom. Any ideas what's going on?

 

############################################################################################################################
#                                                                                                                          #
#                                        unRAID Server Pre-Clear of disk /dev/sdc                                          #
#                                       Cycle 1 of 1, partition start on sector 64.                                        #
#                                                                                                                          #
#                                                                                                                          #
#   Step 1 of 5 - Pre-Read in progress ...                                                                                 #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
############################################################################################################################
#                                 Cycle elapsed time: 0:00:01 | Total elapsed time: 0:00:02                                #
############################################################################################################################


############################################################################################################################
#                                                                                                                          #
#                                                   S.M.A.R.T. Status                                                      #
#                                                                                                                          #
#                                                                                                                          #
#   ATTRIBUTE                      INITIAL    STATUS                                                                       #
#   5-Reallocated_Sector_Ct        0          -                                                                            #
#   9-Power_On_Hours               12038      -                                                                            #
#   194-Temperature_Celsius        35         -                                                                            #
#   196-Reallocated_Event_Count    0          -                                                                            #
#   197-Current_Pending_Sector     0          -                                                                            #
#   198-Offline_Uncorrectable      0          -                                                                            #
#   199-UDMA_CRC_Error_Count       0          -                                                                            #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
############################################################################################################################
#   SMART overall-health self-assessment test result: PASSED                                                               #
###########################################################################################################################?

/usr/local/emhttp/plugins/preclear.disk.beta/script/preclear_disk.sh: line 597: 21233664 + dd: : syntax error in expression (error token is
": ")

--> ATTENTION: Please take a look into the SMART report above for drive health issues.

--> RESULT: Preclear finished succesfully.


/usr/local/emhttp/plugins/preclear.disk.beta/script/preclear_disk.sh: line 1302: /boot/preclear_reports/preclear_report_WD-WMAY01461783_2016
.07.29-02:00:58.txt: Invalid argument
root@MediaServer:/usr/local/emhttp#

Link to post

I am using the beta plugin with RC3. Unfortunately, it is not working (stays in "starting" mode for over an hour). Any thoughts based on the diagnostic log?

 

Same issue! :(

 

Nothing in the logs at all.

 

Edit: Running the script manually results in preclear_disk.sh: fork: Cannot allocate memory

Edit 2: Closed a few dockers - now running... (only will work from the command line but GUI updates...) Nothing in any logs!?

 

Edit 3: Crashed 8 hours in with:

 

./preclear_disk.sh: fork: Cannot allocate memory

./preclear_disk.sh: fork: Cannot allocate memory

 

Never had this before!?

 

Edit 4: Closed crashplan docker (which was using 1.5GB or so) and now it has almost run to completion.

 

Why on earth is preclear requiring so much memory!?

Link to post

FEATURE REQUEST for beta version:

 

Some newly added drives have smart disabled. In that state if the preclear script (beta) is run, there are no smart attributes retrieved. It kind of defeats the purpose of running the preclear to stress test the drives as one cannot compare the values before and after.

 

Could you modify the script to make sure that smart is enabled prior to start and enable it if it wasn't?

 

I currently do the following to enable it manually but sometimes forget or not realize:

smartctl --smart=on /dev/sdX

 

Thanks

Link to post

@cyriouslydylan    Have you modified the  original preclear_disk.sh with the following command for use 6.2.X?

 

    http://lime-technology.com/forum/index.php?topic=13054.msg481622#msg481622

 

Read this post and the next one from Joe L.  Note that there are two plugins in this Preclear Plugin thread.  The Preclear Disk plugin and Preclear Disk Beta plugin.  The former requires a shell script to run and the latter does not.

Link to post

Gone back to the original 'faster preclear' script with the sed mod as it works.

 

No output in any log to suggest why the beta just doesnt work on my system - manually running it from the command line results in the  ./preclear_disk.sh: fork: Cannot allocate memory error.

 

Again, nothing in any log.

 

If it aint broke...!

Link to post

I updated the script with SED command and still stuck on Starting when I try to clear my unassigned disk.  Am I missing something?  I checked the script and the changes did complete. 

 

@cyriouslydylan    Have you modified the  original preclear_disk.sh with the following command for use 6.2.X?

 

    http://lime-technology.com/forum/index.php?topic=13054.msg481622#msg481622

 

Read this post and the next one from Joe L.  Note that there are two plugins in this Preclear Plugin thread.  The Preclear Disk plugin and Preclear Disk Beta plugin.  The former requires a shell script to run and the latter does not.

Link to post

gfjardim,

 

First, thanks very much for creating this plug-in.  I've been wishing for a GUI front-end for years.

 

Second, I just got to test it for the first time, and have a problem using the Beta.

 

I'm running 6.1.9, and I am attempting to pre-clear 2 drives at the same time.

 

I am only able to pre-clear one drive at a time.  As soon as I start the second drive, the progress on the first drive stops, and I see this message (twice) in the 'Preview' icon output: 

 

/usr/local/emhttp/plugins/preclear.disk.beta/script/preclear_disk.sh: fork: Cannot allocate memory

 

When I attempt to restart the pre-clear on the first drive, the progress on the second drive stops.  This has all been occurring during the pre-read step, as I've never let it go long enough to begin the pre-clearing step before starting the next drive.

 

Diagnostic are attached.

 

The preclear.disk.beta.log was surprisingly short:

 

Tue Aug 9 17:40:47 EDT 2016: PHP Warning: unlink(/tmp/preclear_stat_sdr): No such file or directory in /usr/local/emhttp/plugins/preclear.disk.beta/Preclear.php on line 369

 

 

One last thought:  I just read through 51 pages in this thread, only a portion of which is applicable to the Beta, and at times it is confusing which plug-in is being discussed.  Perhaps it is time the Beta gets a dedicated thread?  It would have also been incredibly helpful if you maintained the first post, including instructions on how to report issues, since that is the first thing a user reads when following the link from Community Applications.  I actually thought I had following the wrong link since the first post doesn't mention anything about the separate Beta.

 

Thanks,

Paul

 

 

tower-diagnostics-20160809-1824.zip

Link to post

A few additional details:

 

I upgraded to 6.2-RC3, but the issue remained the same as 6.1.9.

 

With the array stopped, I can run 2 pre-clears simultaneously. 

 

If I start the array while both pre-clears are running, the pre-clear that was started first is stopped with the same message regarding "fork: Cannot allocate memory". 

 

If I stop the array, I can once again run two pre-clears simultaneously.

 

More craziness:  with the array stopped, if I attempt to start a 3rd simultaneous pre-clear, the 1st pre-clear stops with the "fork: Cannot allocate memory" message, and the 2nd pre-clear immediately changes to "Preclear Finished Successfully!" (even though it was only 2% into the pre-read).  Here's the output from the "Preview":

 

############################################################################################################################
#                                                                                                                          #
#                                        unRAID Server Pre-Clear of disk /dev/sde                                          #
#                                       Cycle 1 of 1, partition start on sector 64.                                        #
#                                                                                                                          #
#                                                                                                                          #
#   Step 1 of 5 - Pre-read in progress:                                                                       (2% Done)    #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#   ** Time elapsed: 0:16:57 | Current speed: 136 MB/s | Average speed: 85 MB/s                                            #
#                                                                                                                          #
############################################################################################################################
#                                Cycle elapsed time: 0:16:59 | Total elapsed time: 0:16:59                                 #
############################################################################################################################


############################################################################################################################
#                                                                                                                          #
#                                                   S.M.A.R.T. Status                                                      #
#                                                                                                                          #
#                                                                                                                          #
#   ATTRIBUTE                      INITIAL    STATUS                                                                       #
#   5-Reallocated_Sector_Ct        0          -                                                                            #
#   9-Power_On_Hours               3798       -                                                                            #
#   194-Temperature_Celsius        33         -                                                                            #
#   196-Reallocated_Event_Count    0          -                                                                            #
#   197-Current_Pending_Sector     0          -                                                                            #
#   198-Offline_Uncorrectable      0          -                                                                            #
#   199-UDMA_CRC_Error_Count       0          -                                                                            #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
#                                                                                                                          #
############################################################################################################################
#   SMART overall-health self-assessment test result: PASSED                                                               #
###########################################################################################################################?

/usr/local/emhttp/plugins/preclear.disk.beta/script/preclear_disk.sh: fork: Cannot allocate memory
/usr/local/emhttp/plugins/preclear.disk.beta/script/preclear_disk.sh: line 597: 88830443520 +  : syntax error: operand expected (error token
is "+  ")

--> ATTENTION: Please take a look into the SMART report above for drive health issues.

--> RESULT: Preclear finished succesfully.


/usr/local/emhttp/plugins/preclear.disk.beta/script/preclear_disk.sh: line 1302: /boot/preclear_reports/preclear_report_WD-WCC1T1173480_2016
.08.09-19:21:37.txt: Invalid argument
root@Tower:/usr/local/emhttp#

 

So it seems that with the array running, I can run only a single pre-clear with the Beta.  With the array stopped, I can run a second pre-clear, but no more than 2 simultaneously. 

 

With the original Joe L. script and Screen, I've run at least 4 pre-clears simultaneously on this server, though that was on 5.x, not 6.x.

 

Paul

Link to post

It looks to me that you are simply running out of RAM to run the preclear processes.  It is not unreasonable to assume that the system consumes more RAM with the array started than with it stopped thus leaving less free for the pre-clear processes.

Link to post

Anecdotal evidence leads me to believe you are correct.

 

With the array stopped and 2 pre-clears running overnight, this morning I observed that the server's memory usage was about 75% (as viewed on the Dashboard).  The pre-reads had just finished and the zeroing was <10% at that time.  My server has 4GB RAM installed.

 

At around 25%-35% of the zeroing, one of the drives stopped preclearing, I got the message "Preclear Finished Successfully!", and when I click the "Preview" button I get a blank window, so I can't see any details.  There is nothing in the unRAID log file, or the preclear.disk.beta.log file to give any further insight.

 

I don't know what my memory utilization was at the moment it stopped, but afterwards the memory usage was down to about 49%.

 

I'm thinking my baseline memory utilization was ~25% with the array running, surely less with it stopped.

 

I know memory is cheap and all, and now that we've got 64-bit unRAID that I can throw more memory at the problem, but it seems to me that a pre-clear consuming 1-2GB of RAM is not ideal.  To support 4 simultaneous pre-clears, plus keep the array up and running, I would need 16GB.  Though it needs retesting to verify, I think I could run the same using Joe L.'s script with my current 4GB.

 

This leads me to ponder if the Beta pre-clear is wasting memory, or if due to improved functionality it simply consumes more memory by design. 

 

I would prefer to stick with the Beta version going forward, and I hope that the potential memory issues described here are fixable.

 

 

 

Link to post

It looks to me that you are simply running out of RAM to run the preclear processes.  It is not unreasonable to assume that the system consumes more RAM with the array started than with it stopped thus leaving less free for the pre-clear processes.

 

True - however, the original preclear script works perfectly every time, the 'beta' script crashes with OOM errors on my box.

 

Why does the new script require so much memory!? I'd be concerned if it was using more than 200-300MB!

Link to post

I just ran a "top" to see how much memory is being used.  I see there are three "preclear_+" commands running, which makes sense, since I had started three, 2 of which have stopped due to memory issues, but all three underlying processes are still running. 

 

All three pre-clears (including the two that stopped) are using 1.15GB of RAM each, which is 30% of my unRAID allocated memory (3.853GB allocated of 4GB installed).

 

I find it interesting that all three are using 1.15GB, and only one has run more than an hour or so (about 24 hours now).  This suggests that this isn't a memory leak, but rather all the memory is allocated at pre-clear start up, which agrees with the immediate memory errors I got when starting additional pre-clears.

 

That is a lot of memory for a single process.

 

Link to post

I've been doing some more testing, and wanted to share my results.

 

First, I upgraded my server to 16GB (the max of my motherboard).  Baseline metrics:  On a fresh boot, with array stopped the server is using 4% of allocated memory, with the array running it is using 8% of 16GB.

 

With the array running, I then started a single pre-clear while watching "top".  Memory utilization jumped from 8% to 15%.  Interestingly, I see multiple "preclear_+" processes.  There seems to be a main one, consuming 1.023GB within a few seconds of starting.  I occasionally see 1 or 2 more pop up (I'm sorting by memory usage, so they pop to the top for brief moments).  When the show up, they are using unique PID's and 1.022GB of RAM each (in addition to the 1.023 used by the main "preclear_+".  These extra "preclear_+" processes only stay there a second and then they're gone, and each time they return they have new PID's.

 

If I am interpreting this correctly, there is the main preclear process running all the time, consuming just over 1GB of RAM, and it occasionally creates/destroys 1 or 2 extra processes to do some extra tasks, and these are both consuming about 1GB of RAM each.  But I'm not sure I'm interpreting this correctly because, for the brief moments that the extra preclear processes pop up, the free/used/cache/avail mem stats don't move enough to verify that the two extra processes are consuming another 2GB of RAM.

 

I then started a second pre-clear.  Increasing the server memory from 4GB to 16GB appears to have addressed the errors I was receiving before.  Memory utilization climbed to 21%.  On average, memory utilization is going up 6.5% of 16GB, which matches up nearly exactly with the 1.023GB per primary process that I see in Top.

 

Going back to top, I see a second primary "preclear_+" running, this time consuming 1.024 GB instead of 1.023GB.  I got smart and applied a filter in top to only show the "preclear_+" processes, and changed the update frequency to 10Hz.  It then became very obvious that the two main processes were each constantly spawning and killing two extra processes, about once a second.  For brief moments I can see up to six total processes running.  And while top seems to indicate that each of the six processes are using 1+GB each, the server memory stats stay rock solid during process creation and destruction, so I'm thinking this is actually memory being shared between a parent process and child processes, so each pre-clear is using 1GB of RAM, and not actually up to 3GB that Top seems to indicate.

 

I also just noticed that 7th and 8th pre-clear processes pops up.  This is happening so fast, it's almost impossible to notice.  So each pre-clear is actually spawning 3 simultaneious sub-processes each... that I can see.  This is all during the pre-read stage.

 

So I think I'm pretty much done with my testing.  Each beta pre-clear uses just over 1GB of RAM from start-up, and throwing memory at the problem alleviated the memory related errors.  I don't have enough spare disks at the moment to test more than two pre-clears simultaneously, perhaps later.

 

I also looked at the source code to see if I could find a reason for the high memory usage.  Nothing popped out at me, but honestly the code is way beyond my skill level.  Wish I could help more.

 

Link to post

hey guys have unraid 6.1 and using the plugin from Community Applications, preclear plugin ver 1.15..

 

read trough some of the this thread only wish this board had a search within the thread but couldnt find a fix..

 

my plugin is stuck at starting.

 

/boot/config/plugins/preclear.disk/preclear_disk.sh  -c 3 /dev/sdb 2>/tmp/preclear.log

root@FatJoe:/usr/local/emhttp# /boot/config/plugins/preclear.disk/preclear_disk.sh  -c 3 /dev/sdb 2>/tmp/preclear.log

Pre-Clear unRAID Disk /dev/sdb

################################################################## 1.15

smartctl may not be able to run on /dev/sdb with the -d ata option.

however this should not affect the clearing of a disk.

smartctl exit status = 2

smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.1.18-unRAID] (local build)

Copyright © 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: Invalid argument

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.$

Do you wish to continue?

(Answer Yes to continue. Capital 'Y', lower case 'es'): Yes

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

########################################################################

invoked as  /boot/config/plugins/preclear.disk/preclear_disk.sh -c 3 /dev/sdb

########################################################################

(MBR 4k-aligned set. Partition will start on sector 64 for disks <= 2.2TB and sector 1 for disks > 2.2TB)

Are you absolutely sure you want to clear this drive?

(Answer Yes to continue. Capital 'Y', lower case 'es'):

 

Link to post
  • trurl featured, unfeatured and pinned this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.