The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
What the command to find out the record length of a fixed length file? tranq01 UNIX for Dummies Questions & Answers 9 12-04-2008 04:04 PM
bdf , /etc/fstab , /etc/mnttab Cameron HP-UX 6 12-03-2007 10:34 AM
Length of a Unix filepath max length wilsontan UNIX for Dummies Questions & Answers 3 02-22-2006 10:19 AM
Sed working on lines of small length and not large length thanuman UNIX for Dummies Questions & Answers 3 04-15-2005 06:12 AM
creating a fixed length output from a variable length input r1500 Shell Programming and Scripting 2 12-03-2003 01:09 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-04-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Exclamation /etc/mnttab is zero length - I have done a silly thing

Being the clever-clogs that I am, I have managed to clobber the contents of /etc/mnttab.

It started when I tried to unmount all the volumes in a prticular veritas disk group and neglected to include a suitable grep in my command line, thus attempting to unmount _all_ the filesystems on the server (for loop).

They all came back with a fs busy message so I was presuming no harm done. However, a df to check all was in order came back with no results, likewise running mount.

When I went to look in the mnttab itself I find it's zero length !?!

Everything appears ok in that the filesystems are still actually mounted and read/write.

If I try a mount or umount I get the message
"mount: Inappropriate ioctl for device"

I suspect a reboot would sort me out but that's a big hammer and I'd rather get to the bottom of it.

What have I done and how in the world do I fix it?

Running solaris 10 on a T2000, fairly recent patches applied. Bugger all running aside from base OS and SAN kit.
  #2 (permalink)  
Old 12-05-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
I understand that /etc/mnttab is actually implemented as a screwy filesystem itself on Solaris. I read somewhere that:

umount /etc/mnttab
mount -F mntfs mnttab /etc/mnttab

might rebuild it. But I have never tried it. I guess you get to run the experiment.
  #3 (permalink)  
Old 12-05-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by Perderabo View Post
I understand that /etc/mnttab is actually implemented as a screwy filesystem itself on Solaris.
On Solaris 7 (I think) it behaved as just a file, where the mount/umount programs adjusted it, but the umount system call didn't touch it.

You could use the tried and tested Windows solution,..... reboot it.
  #4 (permalink)  
Old 12-05-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Quote:
Originally Posted by porter View Post
On Solaris 7 (I think) it behaved as just a file, where the mount/umount programs adjusted it, but the umount system call didn't touch it.

You could use the tried and tested Windows solution,..... reboot it.
Yeah I had that as my backup plan but I had a little time as it was still working (sort of) so I figured I'd try and find a cleaner fix

Interesting that the system call didn't update the mnttab in the old days, I could see that creating a bit of a potential mess. I've done very little work with sol7, went straight from 2.6 to 8 with the memorable exception of trying to run some NIS+ servers on 7 (shudder).
  #5 (permalink)  
Old 12-06-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Update

Since posting the above I've found another side-effect of using this solution - it appears that if you have a filesystem not mounted that is in the vfstab, the above command will tell the mnttab that it is mounted - resulting in confusion.

I fixed it but "unmounting" all of these volumes then mounting them for real.
  #6 (permalink)  
Old 12-07-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Solaris has a lot of screwy pseudo filesystems these days. Used to be we would write pseudo device drivers to sneek code into the kernel. I'm disappointed with the Solaris mntfs, it's not as robust as I would have hoped. There always was a problem with /etc/mnttab. The system calls never updated it, instead they update tables in the kernel. This is one of several reasons why a user was supposed to always use the mount command and not just the sytem call. After a reboot, /etc/mnttab would often have garbage entries. The setmnt command was used to initialize it. I had hoped the the mntfs stuff would, in effect, make the kernel tables and /etc/mnttab different views of the same thing, but it seems this is not the case. It seems to be just a special purpose memory based filesystem. I guess it will self-reset at reboot. And you can update /etc/mnttab while / is mounted read-only. Maybe it has some some code to keep all of the other screwball filesystems invisible. But I'm disappointed that it can get out of sync with what is really mounted.

As for your problem, my best guess is that you umounted /etc/mnttab, an operation which ideally would have been disallowed. But I guess it has to be allowed to fix /etc/mnttab when it breaks.
  #7 (permalink)  
Old 12-05-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Thumbs up

Quote:
Originally Posted by Perderabo View Post
I understand that /etc/mnttab is actually implemented as a screwy filesystem itself on Solaris. I read somewhere that:

umount /etc/mnttab
mount -F mntfs mnttab /etc/mnttab

might rebuild it. But I have never tried it. I guess you get to run the experiment.
Total success! Perderabo, you rule!

The umount failed (no surprise, the first thing it does is looks at the mnttab) but the mount worked perfectly - I now have a fully populated mnttab again.

That one's a completly new idea to me - I'd never heard of the mntfs filesystem type before (or the bizaare idea of having the mnttab as a virtual filesystem). Solaris is a strange animal for sure.

I'd be keen to hear anyone's theory as to how I broke it in the first place though...
Closed Thread

Bookmarks

Tags
inappropriate ioctl for device

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0