LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-28-2014, 07:07 AM   #1
ganesan_p
Member
 
Registered: Jun 2014
Posts: 37

Rep: Reputation: Disabled
checking filesystem


hi i know the chkfsys utility and know how to check through command line . but i want to check in script .

i have cf having 4 partition . 1st partition having qnx image . after booting i have to check filesystem on other partition . if any error having those partition i have to display the error and shutdown . i don't how to do it. please help me to check filesystem in scipting and take decission .

questions:
1) if error on any partition ,chkfsys utility returns anythink?
2) how to take decissions if errors occur?
3) how i kow this partition is error?.

note:i have partition type- hd0t77,hd0t78,hd0t79,hd0t80

i checked below script but this is also not working . "status:not found" error is comming ,

#!/bin/sh
######
# My Test Script
######

echo Test Chkfsys Output

chkfsys -u /dev/hd0t77 $1
STATUS=$?
if test STATUS -ne 0
then
echo "An error occured while running chkfsys!"
else
echo"error not occured"

fi

# end of Test Script

please help me,

thanks and regards,
ganesan

Last edited by ganesan_p; 07-28-2014 at 07:08 AM.
 
Old 07-28-2014, 08:01 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,129

Rep: Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374
see man page, or here: http://www.qnx.com/developers/docs/q...g_chkfsys.html
chkfsys will return nonzero in case of problems.

you need to use $ in your test command:
if test $STATUS -ne 0
 
Old 07-29-2014, 09:12 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,817

Rep: Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006
Quote:
Originally Posted by ganesan_p View Post
hi i know the chkfsys utility and know how to check through command line . but i want to check in script .
i have cf having 4 partition . 1st partition having qnx image . after booting i have to check filesystem on other partition . if any error having those partition i have to display the error and shutdown . i don't how to do it. please help me to check filesystem in scipting and take decission .

questions:
1) if error on any partition ,chkfsys utility returns anythink?
If you know how to use the chkfsys utility, then you should know what it returns...especially since the man page TELLS YOU.
Quote:
2) how to take decissions if errors occur?
This is your script...YOU made the decisions however you'd like. Check the return code, and act on whatever you find.
Quote:
3) how i kow this partition is error?.
You know by CHECKING THE OUTPUT of the command you ran
Quote:
note:i have partition type- hd0t77,hd0t78,hd0t79,hd0t80

i checked below script but this is also not working . "status:not found" error is comming ,
Code:
#!/bin/sh
echo Test Chkfsys Output

chkfsys -u /dev/hd0t77 $1
STATUS=$?
if test STATUS -ne 0
then
    echo "An error occured while running chkfsys!"
else
    echo"error not occured"
   
fi

# end of Test Script
...which is VERY similar to your other thread:
http://www.linuxquestions.org/questi...em-4175511911/

You're getting "not found", because you just put "chkfsys" in your script, probably. Try putting the whole path into the script...and again, reading the bash scripting tutorials wouldn't be a bad idea.
 
Old 07-30-2014, 05:31 AM   #4
ganesan_p
Member
 
Registered: Jun 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
hi ,
i have one question,

can mount the corrupted filesystem partition?


regards,
ganesan
 
Old 07-30-2014, 08:34 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,817

Rep: Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006Reputation: 8006
Quote:
Originally Posted by ganesan_p View Post
hi ,
i have one question,

can mount the corrupted filesystem partition?
Since it's CORRUPTED, obviously not. Please see any of your other numerous threads about partitions for more hints to help you get going.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie: 'Checking Filesystem' message at start up AndyL Puppy 8 09-10-2008 05:18 AM
Checking the integrity of an Ubuntu filesystem silent_n0va Linux - Newbie 1 07-30-2008 05:15 AM
dm-crypted root with filesystem checking /y0shi Slackware 3 02-16-2008 06:55 AM
booting stops at - checking root filesystem varun_saa Mandriva 3 09-29-2005 12:58 AM
RAID 0 Filesystem checking? kennic Red Hat 2 11-12-2004 01:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration