What do first column in /proc/mounts really mean in Linux?

5,550

Solution 1

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 /.

Solution 2

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).

Share:
5,550
presence
Author by

presence

Updated on September 18, 2022

Comments

  • presence
    presence over 1 year

    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.

  • presence
    presence over 12 years
    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?
  • presence
    presence over 12 years
    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?
  • jw013
    jw013 over 12 years
    I think ramfs counts as a mountable device. The / in front of /vmfs makes me think it is a file located in /.
  • presence
    presence over 12 years
    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".