- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: FSCK vxfs returning code ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 07:32 AM
08-23-2005 07:32 AM
I have to make a backup script that works on a BCV, and I must do a fsck on the volumes before mounting them on our Media Server (of course... :-). The situation I want to handle is if a "regular" fsck doesn't work, I'd try the full one. I cannot performa a full one on all of the volumes due to time restrictions.
But when checking fsck_vxfs man page, I found the information confusing about returning codes. There are several for the "-m" option, but no returning code if it ends asking for a full FSCK. Instead, it describes outputs. Below is a excerpt from the refered man page.
What should I do? Plenty of points to assign.
Thanks in advance,
Filipe.
"
In most cases, fsck prints the following messages:
log replay in progress
replay complete - marking super-block as CLEAN
If the file system is already clean, fsck prints the following message
instead:
file system is clean - log replay is not required
If fsck prints any other messages, a full structural check is needed.
"
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 07:43 AM
08-23-2005 07:43 AM
Re: FSCK vxfs returning code ...
"replay complete - marking super-block as CLEAN"
Is a normal message ,when it checks in phase 1 - Check Blocks and Sizes
and running full fsck , i.e # fsck -F vxfs -o full /dev/vgxx/lvolxy
Cheers,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 07:44 AM
08-23-2005 07:44 AM
Re: FSCK vxfs returning code ...
Get the output of fsck to some variable and then just grep for the known words, like "CLEAN" or "full", this how you can know how fcks ended ...
Alex.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 07:51 AM
08-23-2005 07:51 AM
Re: FSCK vxfs returning code ...
man pages->HP-UX 11i man pages -> fsck_vxfs (1m)
RETURN VALUES [Toc] [Back]
Structural errors discovered during a full check are displayed on
standard output. Responses required during a full check are read from
standard input.
The following return codes are used for the -m option for all devices
other than the one used by the root file system:
0 The file system is unmounted and clean.
32 The file system is unmounted and needs checking.
33 The file system is mounted.
34 The stat of the device failed.
Other
The state could not be determined because of an error.
The following return codes are used for the -m option for the device
used by the root file system:
0 The root file system is mounted read-only and is clean, or
the root file system is mounted read/write and therefore is
clean.
32 The root file system is mounted read-only and needs
checking.
Alex.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 07:57 AM
08-23-2005 07:57 AM
Re: FSCK vxfs returning code ...
From the man page it is seen that
"fsck will return 0 if the file system is suitable for mounting. If the file system needs additional checking, the return code is 32. If the file system is mounted, the return code is 33. Error codes larger than 33 indicate that the file system is badly damaged."
So write a script and get the return codes. I think $? gives the return code in shell script.
if error code is 0 proceed with mounting.
If error code is 32 proceed with full FS fsck
and if error code is greater than 33 echo FS problem..
Regards
CS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 08:05 AM
08-23-2005 08:05 AM
Re: FSCK vxfs returning code ...
In short ,here are the error codes returns by fsck:
0 Either no errors were detected or all errors were corrected.
32 The file system needs additional checking.
33 The file system is mounted.
Return values greater that 33 indicate that file system is badly corrupted.
You can catch these in a shell script with "echo $? ".
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 08:27 AM
08-23-2005 08:27 AM
Solutioncat /etc/fstab | grep -v "..." | while read line
do
lv=`echo $line | awk {'print $1'}`
fs=`echo $line | awk {'print $2'}`
fsck $lv # > /dev/null (if you do not want clutter on screen)
r=${?}
case $r in
0) echo "Volume $lv is fine. Mounting."
mount $fs
;;
32) echo "Volume $lv needs full fsck. Proceeding"
fsck -o full $lv ; r2=${?}
if [ $r2 -eq 0 ]
then
echo "Volume $lv has been repaired. Mounting."
mount $fs
else
echo "Volume $lv could not be repaired. Please investigate. Skipping..."
fi
;;
33) echo "filesystem is already mounted."
;;
*) echo "Volume $lv has problems fsck can not handle. Please investigate."
;;
esac
done
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 10:46 AM
08-23-2005 10:46 AM
Re: FSCK vxfs returning code ...
We have commonly done this for 4+ years on our BC disks (120) using /usr/sbin/fsck -F vxfs
on each.
The time was minimal and this was performed each night prior to mounting the BC voumes for backup.
We use a simple for loop, reading a file of all the disks and output the results to a file for review if necessary. Of course the return code was checked after each command issuance as well.
Regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 12:01 PM
08-23-2005 12:01 PM
Re: FSCK vxfs returning code ...
Fsck is the key to your success. Try to do a man on it.
John E. Ophious
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 04:57 PM
08-23-2005 04:57 PM
Re: FSCK vxfs returning code ...
I'd just like to throw my usual reminder in that a 'full' fsck is still comfortably fast, because it's still using the vxfs log.
To do a *full* fsck of the filesystem structure, You need to run fsck -Fvxfs -o full,nolog
to verify both log and fs are consistent I usally run both of them. :)
Also, I'm a bit surprised You're not only running a fsck -n [options] when handling BCV volumes. It's of course ok as long as the messages from fsck are really monitored, but if not, You might have consistent backups of inconsistent production filesystems ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2005 05:25 AM
08-24-2005 05:25 AM
Re: FSCK vxfs returning code ...
Yes, I am aware of the 0, 32 and 33 thing, regarding the -m option. The issue here is that it is not clear in the man page that it is the same when fsck is doing the real thing.
Due to the responses here, I will assume those returning codes as a fact in both cases. Anyway, I cannot test it, at least in time to do these scripts...
Regards,
Filipe.