Sponsored Content
Top Forums UNIX for Advanced & Expert Users /etc/mnttab is zero length - I have done a silly thing Post 302149678 by Perderabo on Thursday 6th of December 2007 11:31:01 PM
Old 12-07-2007
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. Smilie
 

10 More Discussions You Might Find Interesting

1. Solaris

Silly question

Are GNOME or javadsktop supported of the box on Solaris 10 on Ultra (SUNBlade 1500) ? I'could switch desktops to KDE at CDE logon. But when I tried to use the JavaDesktop it simply returns me back to the log on screen of CDE. How do I conigure to the latest GNOME and.or JavaDesktop if... (3 Replies)
Discussion started by: miket
3 Replies

2. HP-UX

bdf , /etc/fstab , /etc/mnttab

Hi all, Would like to know if it is possible to rearrange the order that mounts are displayed when the 'bdf' command is issued. An example of what I mean is, currently I see the following ... $ bdf -l Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 524288 ... (6 Replies)
Discussion started by: Cameron
6 Replies

3. UNIX for Dummies Questions & Answers

silly question

How do I go about finding the number of unique words in a file. (3 Replies)
Discussion started by: EECSDAVE
3 Replies

4. Linux

veritas hasf /etc/mnttab

Hi All, Where is now the /etc/mnttab if you are in veritas sfha for red hat es 4? Thanks in advance for any comments. (2 Replies)
Discussion started by: itik
2 Replies

5. UNIX for Dummies Questions & Answers

/etc/vfstab vs /etc/mnttab

what is the difference between the /etc/vfstab and /etc/mnttab? when i check both files, the content is almost the same. can you enlighten me? what i know is /etc/vfstab is used for hard mounts. (4 Replies)
Discussion started by: hrist
4 Replies

6. Solaris

My /etc/mnttab file is showing ro permission for /usr

Hi All, My current /usr utilization is 100%.As i don't have another harddisk i decided to delete some unnecessary files under /usr.But,while deleteing it is giving error "it is a readonly filesystem".I checked /etc/mnttab file it is showing the following entry /dev/lofi/1 /usr hsfs ... (3 Replies)
Discussion started by: navjotmannan
3 Replies

7. Solaris

what is the difference between /etc/mnttab and /etc/vfstab

what is the difference between /etc/mnttab and /etc/vfstab???? what are these files used for one time i removed mnttab file from my solaris box. infact i renamed it and my solaris box was not booting properly. (12 Replies)
Discussion started by: chidori
12 Replies

8. Solaris

MNTTAB and NFS questions

SunOS 5.10 Generic_142900-15 sun4u sparc SUNW,SPARC-Enterprise I have been asked to move all file from /CV to /EABATCH looking at our mnttab I see these two entries. wdcprodhome:/eabatch/EABATCH /EABATCH nfs nodevices,bg,intr,xattr,zone=cbp011,dev=5500010 1288539528 ... (0 Replies)
Discussion started by: Harleyrci
0 Replies

9. Post Here to Contact Site Administrators and Moderators

Might be silly question

Hi Team, In case if i want to delete one of my posting thread.. can i delete that? Just asking to know.. (5 Replies)
Discussion started by: darling
5 Replies

10. UNIX for Dummies Questions & Answers

/etc/mnttab empty UNIXware 7.1.3

Hi Guys New to this forum so apologies if posted in wrong place. Got a unixware 7.1.3 system (I know !). df -k produces no output which I believe is because /etc/mnttab is empty. Can /etc/mnttab be re-built ? Thanks (2 Replies)
Discussion started by: deel
2 Replies
getmntent(3C)						   Standard C Library Functions 					     getmntent(3C)

NAME
getmntent, getmntany, getextmntent, hasmntopt, putmntent, resetmnttab - get mounted device information SYNOPSIS
#include <stdio.h> #include <sys/mnttab.h> int getmntent(FILE *fp, struct mnttab *mp); int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref); int getextmntent(FILE *fp, struct extmnttab *mp, int len); char *hasmntopt(struct mnttab *mnt, char *opt); int putmntent(FILE *iop, struct mnttab *mp); void resetmnttab(FILE *fp); DESCRIPTION
getmntent() and getmntany() The getmntent() and getmntany() functions each fill in the structure pointed to by mp with the broken-out fields of a line in the mnttab file. Each line read from the file contains a mnttab structure, which is defined in the <sys/mnttab.h> header. The structure contains the following members, which correspond to the broken-out fields from a line in /etc/mnttab (see mnttab(4)). char *mnt_special; /* name of mounted resource */ char *mnt_mountp; /* mount point */ char *mnt_fstype; /* type of file system mounted */ char *mnt_mntopts; /* options for this mount */ char *mnt_time; /* time file system mounted */ Fields with no actual content in /etc/mnttab are represented in the file as "-". To clearly distinguish empty fields, getmntent() set the corresponding field in mp to NULL. Each getmntent() call causes a new line to be read from the mnttab file. Successive calls can be used to search the entire list. The getmn- tany() function searches the file referenced by fp until a match is found between a line in the file and mpref. A match occurs if all non- null entries in mpref match the corresponding fields in the file. These functions do not open, close, or rewind the file. getextmntent() The getextmntent() function is an extended version of the getmntent() function that returns, in addition to the information that getmn- tent() returns, the major and minor number of the mounted resource to which the line in mnttab corresponds. The getextmntent() function also fills in the extmntent structure defined in the <sys/mnttab.h> header. For getextmntent() to function properly, it must be notified when the mnttab file has been reopened or rewound since a previous getextmntent() call. This notification is accomplished by calling resetmnttab(). Otherwise, it behaves exactly as getmntent() described above The data pointed to by the mnttab structure members are stored in a static area and must be copied to be saved between successive calls. hasmntopt() The hasmntopt() function scans the mnt_mntopts member of the mnttab structure mnt for a substring that matches opt. It returns the address of the substring if a match is found; otherwise it returns 0. Substrings are delimited by commas and the end of the mnt_mntopts string. putmntent() The putmntent() function is obsolete and no longer has any effect. Entries appear in mnttab as a side effect of a mount(2) call. The func- tion name is still defined for transition purposes. resetmnttab() The resetmnttab() function notifies getextmntent() to reload from the kernel the device information that corresponds to the new snapshot of the mnttab information (see mnttab(4)). Subsequent getextmntent() calls then return correct extmnttab information. This function should be called whenever the mnttab file is either rewound or closed and reopened before any calls are made to getextmntent(). RETURN VALUES
getmntent() and getmntany() If the next entry is successfully read by getmntent() or a match is found with getmntany(), 0 is returned. If an EOF is encountered on reading, these functions return -1. If an error is encountered, a value greater than 0 is returned. The following error values are defined in <sys/mnttab.h>: MNT_TOOLONG A line in the file exceeded the internal buffer size of MNT_LINE_MAX. MNT_TOOMANY A line in the file contains too many fields. MNT_TOOFEW A line in the file contains too few fields. hasmntopt() Upon successful completion, hasmntopt() returns the address of the substring if a match is found. Otherwise, it returns 0. putmntent() The putmntent() is obsolete and always returns -1. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
mount(2), mnttab(4), attributes(5) SunOS 5.10 22 Mar 2004 getmntent(3C)
All times are GMT -4. The time now is 03:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy