Skip navigation.
Home
The QNX Community Portal

View topic - filesystem checking?

filesystem checking?

Discussion about the QNX6 OS.

filesystem checking?

Postby ganesan » Fri Jul 25, 2014 9:50 am

hi,

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

thanks and regards,
ganesan palanisamy
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby maschoen » Fri Jul 25, 2014 1:21 pm

First, I think it's worth noting that chkfsys only works on a QNX 4 initialized partition.
QNX 6 partitions seem to have no equivalent checking program. Maybe it doesn't need one?

Second, your request seems quite strange, to detect that a partition has corruption and the shut down.
The function of chkfsys is to fix a partition, so why shut down afterwards?

Your question about whether chkfsys sends a meaningful return code is a good one that you can determine by testing.
The default ksh that QNX uses has a variable you can check after a program runs that is set to the return code, so I would
just create a simple script that runs chkfsys and then prints it out.

For testing it's fairly easy to create some corruption. Create a program that opens a file, writes some data, and then goes to sleep.
After the program goes to sleep, power down.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: filesystem checking?

Postby Tim » Fri Jul 25, 2014 5:42 pm

Code: Select all
#!/bin/sh
######
# My Test Script
######

echo Test Chkfsys Output

chkfsys -u MountPoint $1
STATUS=$?
if test STATUS -ne 0; then
    echo "An error occured while running chkfsys!"
   shutdown -bf
fi

# end of Test Script


Where MountPoint is the mount info for your partitions (use the df command). On my system for example I have
/dev/hd0t79 mounted as /
/dev/hd1t77 mounted as /fs/ram

To check my Ram disk I run

chkfsys -u /fs/ram

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: filesystem checking?

Postby ganesan » Mon Jul 28, 2014 9:28 am

hi TIM,

thanks for your reply,

this code is not working.

error:
status: not found
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby ganesan » Mon Jul 28, 2014 12:03 pm

hi ,
thank you your reply,

this script is not working well,
status :not found error os comming

chkfsys utility is return any value?

regards,
ganesan
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby Tim » Mon Jul 28, 2014 6:56 pm

ganesan wrote:this script is not working well,
status :not found error os comming


You've done something wrong. 'status: not found' usually indicates the program can't be found. For example if I just type garbage at the command prompt like 'foo' I see: 'sh: foo: not found'. Do you have the proper path specified for chkfsys. This is especially important if you are checking in a boot image. You must have chkfsys in the boot image itself.

chkfsys utility is return any value?


It does. 0 = success and !0 = error.

I know this because if I run my script as a non-root user I get the error case because non-root users can't run chkfsys. Once I switch to root user I run successfully (since I don't have any errors on my Ram disk). You can test corruption in the manner that Maschoen described.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: filesystem checking?

Postby ganesan » Wed Jul 30, 2014 8:54 am

thanks for your reply TIM,

this script is working good..
but after executing this script it is asking yes/no questions(corruption occur do u want to continue? , bitmap clear) if corruptions occur in partition.
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby ganesan » Wed Jul 30, 2014 10:13 am

hi TIM,

whenever ran the script it is asking user input like...

1) chkfsys: Root directory has wrong status (FIXABLE)
Serious error: continue program (Y/n) ?

2) incorrect link count (3 should be 10): FIXABLE
fix (Y/n) ?

if any errors occur in the partitions.
but i don't want to ask user input and also it won't fix errors automatically.

how i have to avoid the user input please help me..

thanks and regards
ganesan
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby Tim » Wed Jul 30, 2014 6:25 pm

http://www.qnx.com/developers/docs/6.4. ... kfsys.html

You may want to look carefully at the exit status's and take action based on a non-zero result.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: filesystem checking?

Postby ganesan » Mon Aug 04, 2014 11:24 am

hi TIM,
thanks for your reply,

i am using -x option (# chkfsys -x hd0t77).
but it is telling illegal option like (chkfsys: illegal option -- x)

please give the solution ....

thanks and regards,
ganesan
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby ganesan » Wed Aug 06, 2014 11:36 am

thanks for your reply,

i am using with x but its telling illegal option .

e.g:
chkfsys -x /dev/hd0t77
chkfsys: illegal option -- x


regards,
ganesan
ganesan
Active Member
 
Posts: 20
Joined: Tue Jul 08, 2014 6:27 am

Re: filesystem checking?

Postby maschoen » Sun Aug 10, 2014 6:24 pm

-x is not a parameter of chkfsys.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm


Return to QNX6 - OS

Who is online

Users browsing this forum: No registered users and 4 guests

cron