Jump to content
jeffreywhunter

Parity Check from Terminal?

8 posts in this topic Last Reply

Recommended Posts

Trying to diagnose some hardware issues - starting with NO internet (aka no webgui).  So I need a couple tools/techniques.

 

1. Is there a command that can display the progress of a parity check?

2. Is there a script that copies the syslog to the boot folder whenever it changes?

 

Found this command

 

/root/mdcmd status

 

LOTS of information.  Which info out of this command would be appropriate to understand the progress of a parity check?

 

mdResync? mdState?  sbSync?  something else?

 

If I do this: /root/mdcmd status | egrep "mdResync|mdState|sbSync"

 

I get this:

 

sbSynced=0

sbSyncErrs=0

mdState=STARTED

mdResync=1953514552

mdResyncCorr=1

mdResyncPos=631452132

mdResyncDt=31

mdResyncDb=2185144

 

Is there anything that would give a percent complete?  mdResync/mdResyncPos?  Any way I could put that in division in a script and format it?  Or is there a better, already done script I could download?

Share this post


Link to post

My reply is OT but I just wanted to tell you about the link that appears in every post that says "Report to moderator". I used that to report your other thread about this that you wanted the mods to delete because you had posted in the wrong subforum. You can use that link in the future to report your own post.

Share this post


Link to post

Trying to diagnose some hardware issues - starting with NO internet (aka no webgui).  So I need a couple tools/techniques.

 

1. Is there a command that can display the progress of a parity check?

2. Is there a script that copies the syslog to the boot folder whenever it changes?

 

Found this command

 

/root/mdcmd status

 

LOTS of information.  Which info out of this command would be appropriate to understand the progress of a parity check?

 

mdResync? mdState?  sbSync?  something else?

 

If I do this: /root/mdcmd status | egrep "mdResync|mdState|sbSync"

 

I get this:

 

sbSynced=0

sbSyncErrs=0

mdState=STARTED

mdResync=1953514552

mdResyncCorr=1

mdResyncPos=631452132

mdResyncDt=31

mdResyncDb=2185144

 

Is there anything that would give a percent complete?  mdResync/mdResyncPos?  Any way I could put that in division in a script and format it?  Or is there a better, already done script I could download?

Sticking with bash, you could do:

A=$(/root/mdcmd status | egrep mdResyncPos= | sed -r 's/mdResyncPos=(\w+)/\1/')
B=$(/root/mdcmd status | egrep mdResync= | sed -r 's/mdResync=(\w+)/\1/')
RESULT=$(awk "BEGIN {printf \"%.2f\",${A}/${B}*100}")
echo $RESULT

Its not pretty but it works  (bash doesn't support floating point, so the division winds up being done in awk)

Share this post


Link to post

For your syslog you could do

 

tail -f /var/log/syslog >/boot/syslogtail.txt

 

Share this post


Link to post

I was running a parity sync and had an issue with one of my off-line drives which caused the web gui to stop responding.  I found this post helpful in confirming that the parity check was still running.  Thank you all.  I anticipated not being able to access the gui for the duration of the sync, so I took the details from this thread and produced a bash script that replicates the information provided in the web gui:

 

#!/bin/bash

status=$(mdcmd status | sed -n 's/mdState=//p')
size=$(mdcmd status | sed -n 's/mdResync=//p')
pos=$(mdcmd status | sed -n 's/mdResyncPos=//p')
dt=$(mdcmd status | sed -n 's/mdResyncDt=//p')
db=$(mdcmd status | sed -n 's/mdResyncDb=//p')

gbsize=$(awk "BEGIN{ printf \"%.0f\",$size * 1024 / 1000^3}")
gbpos=$(awk "BEGIN{  printf \"%.0f\",$pos * 1024 / 1000^3}")
progress=$(awk "BEGIN{ printf \"%.1f\",($pos / $size) * 100}")
speed=$(awk "BEGIN{ printf \"%.1f\",($db/$dt) * 1024 / 1000^2}")

finish=$(awk "BEGIN{ m=(($dt*(($size-$pos)/($db/100+1)))/100)/60 
                     print int(m/60) \"h \" int(m%60) \"m\"
                   }")

echo "Status:   $status"
echo "Progress: $gbpos GB of $gbsize GB (${progress}%)"
echo "Speed:    $speed MB/sec"
echo "Finish:   $finish"

 

You can create this from the console using nano or vi.  I saved as /boot/syncstatus, and made executable with `chmod +x /boot/syncstatus`

 

If you run this once it will output the current status:

 

Status:   STARTED
Progress: 1101 GB of 4001 GB (27.5%)
Speed:    138.3 MB/sec
Finish:   5h 49m

 

If you want the information to continually update then you can use the `watch` command:

 

watch /boot/syncstatus

 

This will print the sync information and refresh the information every 2 seconds.  You can change the polling period using the -n option (`watch -n 10 /boot/syncstatus` for every 10 seconds).

Share this post


Link to post
On 5/10/2016 at 11:26 PM, jgc said:

I was running a parity sync and had an issue with one of my off-line drives which caused the web gui to stop responding.  I found this post helpful in confirming that the parity check was still running.  Thank you all.  I anticipated not being able to access the gui for the duration of the sync, so I took the details from this thread and produced a bash script that replicates the information provided in the web gui:

 

 


#!/bin/bash

status=$(mdcmd status | sed -n 's/mdState=//p')
size=$(mdcmd status | sed -n 's/mdResync=//p')
pos=$(mdcmd status | sed -n 's/mdResyncPos=//p')
dt=$(mdcmd status | sed -n 's/mdResyncDt=//p')
db=$(mdcmd status | sed -n 's/mdResyncDb=//p')

gbsize=$(awk "BEGIN{ printf \"%.0f\",$size * 1024 / 1000^3}")
gbpos=$(awk "BEGIN{  printf \"%.0f\",$pos * 1024 / 1000^3}")
progress=$(awk "BEGIN{ printf \"%.1f\",($pos / $size) * 100}")
speed=$(awk "BEGIN{ printf \"%.1f\",($db/$dt) * 1024 / 1000^2}")

finish=$(awk "BEGIN{ m=(($dt*(($size-$pos)/($db/100+1)))/100)/60 
                     print int(m/60) \"h \" int(m%60) \"m\"
                   }")

echo "Status:   $status"
echo "Progress: $gbpos GB of $gbsize GB (${progress}%)"
echo "Speed:    $speed MB/sec"
echo "Finish:   $finish"
 

 

 

You can create this from the console using nano or vi.  I saved as /boot/syncstatus, and made executable with `chmod +x /boot/syncstatus`

 

If you run this once it will output the current status:

 

 


Status:   STARTED
Progress: 1101 GB of 4001 GB (27.5%)
Speed:    138.3 MB/sec
Finish:   5h 49m
 

 

 

If you want the information to continually update then you can use the `watch` command:

 

 


watch /boot/syncstatus
 

 

 

This will print the sync information and refresh the information every 2 seconds.  You can change the polling period using the -n option (`watch -n 10 /boot/syncstatus` for every 10 seconds).

Thank you very much for this!  I'm in similar situation as OP and no programming experience but with your post I was able to run your script and see parity sync status from the console.

Share this post


Link to post

not sure what happened overnight but my boot drive dropped and webgui is unresponsive. this bash script has me looking at my parity check status. will reboot server once it finishes up. thanks for the write up!

Share this post


Link to post

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.