Bug 102941 - LTC4022-df FileSystem name doesn't match getmntent's mnt_fsname
LTC4022-df FileSystem name doesn't match getmntent's mnt_fsname
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: anaconda (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: Michael Fulbright
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2003-08-22 16:55 EDT by IBM Bug Proxy
Modified: 2007-11-30 17:06 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-22 17:27:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description IBM Bug Proxy 2003-08-22 16:55:07 EDT
The following has be reported by IBM LTC:  
df FileSystem name doesn't match getmntent's mnt_fsname
Please fill in each of the sections below.

Hardware Environment:
Intel 32 bit (doesn't really matter)

Software Environment:
RHAS 2.1 kernel 2.4.19 or RH 8.0, kernel 2.4.19.  glibc 2.2.4-26
But, our program is compiled with the Intel compiler V7

Steps to Reproduce:
1.Do a df -k /myfilesystem
  You will get a file system with a name like "/dev/hdd6"
2.From within a C program,
  while ((m = getmntent(f)) != NULL)
    if (!strcmp(m->mnt_dir, szDrive))
      j += sprintf(sb + j, "\t<name>%s</name>\n", m->mnt_fsname);

  If this is a Redhat system with Anaconda, you will get back a file
  system name in the format "LABEL=/myfs".

Actual Results:
df -k returns /dev/.. format
getmntent's mnt_fsname returns LABEL=/... format

Expected Results:
I would prefer both return the /dev/... format so it is the same user experience
in RedHat and SuSE.  But, I need them to be consistent so we can match up the


Additional Information:
I am pretty sure that getmntent is pulling the information from /etc/fstab.
RedHat's Anaconda uses the LABEL=/ format for file systems it sets up.  
I am not sure where df gets its information.

If I can't get a fix, I need a work around.  I need a shell command that
given a mount point, I can get the FileSystem name that is in the LABEL= format


A C library routine like getmntent that will return File System names
like df does.

A workaround needs to work on either SuSE or RH.

And, yes, I believe I could change the values in /etc/fstab so getmntent 
works as expected.  But, we are delivering a product that hopefully will be
used by a lot of people with different levels of experience.  I am NOT
willing to recommend they all change their /etc/fstab.
this is an install (anaconda) / file system issue which I think
should be best addressed by Red Hat.  SuSE does not have this problem.  As
Mary pointed out above, anaconda uses the LABEL= format (instead of /dev/
format) as it sets up file systems in /etc/fstab.  Thanks.
Comment 1 Jeremy Katz 2003-08-22 17:27:04 EDT
getmntent returns exactly what is in the fstab.  We mount by label so that if
your SCSI devices change the order they're in, you can still mount your
filesystems.  You could just as well get UUIDs of the filesystem when calling
getmntent.  Relying on it to return devices is broken.

/proc/mounts will have the actual information on mounted filesystems or you can
look at the code in util-linux/mount/get_label_uuid.c to see how mount
determines the labels.
Comment 2 IBM Bug Proxy 2005-06-14 19:29:24 EDT

           What    |Removed                     |Added
                 CC|                            |mranweil@us.ibm.com
             Status|REJECTED                    |CLOSED

------- Additional Comments From mranweil@us.ibm.com  2005-06-14 19:10 EDT -------
Non-duplicate rejected bug that's been rejected for over 6 months.  Marking
closed, you can re-open if needed. 

Note You need to log in before you can comment on or make changes to this bug.