Red Hat Bugzilla – Bug 102941
LTC4022-df FileSystem name doesn't match getmntent's mnt_fsname
Last modified: 2007-11-30 17:06:53 EST
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.
Intel 32 bit (doesn't really matter)
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".
df -k returns /dev/.. format
getmntent's mnt_fsname returns LABEL=/... format
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
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.
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.
What |Removed |Added
------- Additional Comments From email@example.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.