6

Run cat /proc/mounts and I get this (simplified):

rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
/dev/sda1 / ext3 rw,relatime,errors=continue,barrier=1,data=ordered 0 0
io /etc/blkio cgroup rw,relatime,blkio 0 0
...

About the content, document from Red Hat says that:

The first column specifies the device that is mounted, the second column reveals the mount point, and the third column tells the file system type...

I don't think that rootfs is a device, I'm trying to find this device in udev(/dev) but I can't get it. So I don't know which device is mounted in / (You may say that I can use mount to get this information, but what if rootfs here is mounted not by mount command).

Another example is on VMware ESX 3.x server, you cannot find any "vmfs" entry listed in mount's result, but by cat /proc/mounts, I get /vmfs /vmfs vmfs rw 0 0. As the rootfs example, I cannot know which devices are related with the first "/vmfs" here either.

Question: Could someone tell me what does the first column of /proc/mounts really mean?

PS. Please read "How to get the complete and exact list of mounted filesystems in Linux?" for more information about /proc/mounts and mount.

3 Answers 3

5

The first column is indeed the device as the documentation you quoted says. According to kernel.org documentation, rootfs is just a special case of a ramfs (in-RAM filesystem) that the kernel uses to make sure something is always mounted on /. It takes 0 or negligibly small space in RAM only and if you look further in /proc/mounts you should see the entry for the device containing your real root partition mounted on /.

4
  • I see the real device mounted on /, it's /dev/sda1 as I listed in the output of cat /proc/mounts. Now I understand rootfs is a special case, thanks. Could you explain the situation described in the "vmfs" example?
    – xanpeng
    Commented Nov 10, 2011 at 5:20
  • The "vmfs" example may be too specific and I'd better to give up finding its answer. Anyway, based on your answer and my understanding, can I say that the document from Red Hats is not so accurate as rootfs is not a device?
    – xanpeng
    Commented Nov 10, 2011 at 5:28
  • I think ramfs counts as a mountable device. The / in front of /vmfs makes me think it is a file located in /.
    – jw013
    Commented Nov 10, 2011 at 5:45
  • Thanks. Here is a bit more information on ramfs, it says that "The older 'ram disk' mechanism created a synthetic block device out of an area of ram".
    – xanpeng
    Commented Nov 10, 2011 at 6:08
3

The first column in /proc/mounts is the device name as recorded by the kernel. Most of the time, this is the name that was provided when calling mount (see the code of the show_vfsmnt function in the kernel); there's a way for a filesystem to tweak that name, but only NFS and AFS take advantage of this opportunity.

The name rootfs is built into the kernel; it's used for the root filesystem at boot time. There are also cases where the kernel doesn't get a name and uses none.

When you mount a filesystem that's stored on an actual device, the device name is vital: it indicates where that filesystem is. For “virtual” filesystems, the device name is often irrelevant, either there's a single possible backing (e.g. proc, sysfs, binfmt_misc) or each filesystem is independent of any backing (tmpfs) or mount options indicate where the underlying data is (most FUSE filesystems).

0

I'm not sure about rootfs but proc is a "playground" for processes. It's a virtual file system so it won't show up in /dev (I don't think) but it can be mounted.

The actual devices in /dev will be displayed in the first column with an absolute path (like you have for /dev/sda1).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .