What is /etc/mtab in Linux?How to get the complete and exact list of mounted filesystems in Linux?What is the meaning of Scratchbox2?Why would someone choose FreeBSD over Linux?How are NTFS drives handled by Linux? Nothing is in fstab yet it's automounted. Nothing in mtab yet it's currently mountedWhat is the concept of Refresh in Linux, if there is soFinding correct information to update mtab and fstab?UUID in /etc/mtabHow to verify which line in /etc/mtab is not in use/etc/default/sw vs /etc/sw vs /etc/sw.d/Accidentally erased contents of /etc/fstab in Centos 7.2Why every device in Linux is a file or folder ? what are the advantages?

Apply MapThread to all but one variable

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

A Paper Record is What I Hamper

Dynamic SOQL query relationship with field visibility for Users

A ​Note ​on ​N!

What happened to Captain America in Endgame?

Minor Revision with suggestion of an alternative proof by reviewer

"You've called the wrong number" or "You called the wrong number"

How to fry ground beef so it is well-browned

What is causing the white spot to appear in some of my pictures

Check if a string is entirely made of the same substring

How to stop co-workers from teasing me because I know Russian?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

Multiple options vs single option UI

How to limit Drive Letters Windows assigns to new removable USB drives

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

"The cow" OR "a cow" OR "cows" in this context

Extension of 2-adic valuation to the real numbers

How come there are so many candidates for the 2020 Democratic party presidential nomination?

What makes accurate emulation of old systems a difficult task?

Is there a way to generate a list of distinct numbers such that no two subsets ever have an equal sum?

Do I have an "anti-research" personality?

Is Diceware more secure than a long passphrase?

Alignment of various blocks in tikz



What is /etc/mtab in Linux?


How to get the complete and exact list of mounted filesystems in Linux?What is the meaning of Scratchbox2?Why would someone choose FreeBSD over Linux?How are NTFS drives handled by Linux? Nothing is in fstab yet it's automounted. Nothing in mtab yet it's currently mountedWhat is the concept of Refresh in Linux, if there is soFinding correct information to update mtab and fstab?UUID in /etc/mtabHow to verify which line in /etc/mtab is not in use/etc/default/sw vs /etc/sw vs /etc/sw.d/Accidentally erased contents of /etc/fstab in Centos 7.2Why every device in Linux is a file or folder ? what are the advantages?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








26















What is /etc/mtab in Linux?



Why is it needed and advantages of having it?










share|improve this question









New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Related: Is there a command to see where a disk is mounted?

    – Kusalananda
    Apr 23 at 17:35











  • I find it frustrating that man 5 mtab is missing.

    – Weijun Zhou
    Apr 23 at 17:48






  • 2





    Also: unix.stackexchange.com/q/24182/117549

    – Jeff Schaller
    Apr 23 at 18:08

















26















What is /etc/mtab in Linux?



Why is it needed and advantages of having it?










share|improve this question









New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Related: Is there a command to see where a disk is mounted?

    – Kusalananda
    Apr 23 at 17:35











  • I find it frustrating that man 5 mtab is missing.

    – Weijun Zhou
    Apr 23 at 17:48






  • 2





    Also: unix.stackexchange.com/q/24182/117549

    – Jeff Schaller
    Apr 23 at 18:08













26












26








26


4






What is /etc/mtab in Linux?



Why is it needed and advantages of having it?










share|improve this question









New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












What is /etc/mtab in Linux?



Why is it needed and advantages of having it?







linux fstab






share|improve this question









New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Apr 23 at 17:42









Kusalananda

143k18268448




143k18268448






New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 23 at 17:31









Sathish kumarSathish kumar

13723




13723




New contributor




Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Sathish kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Related: Is there a command to see where a disk is mounted?

    – Kusalananda
    Apr 23 at 17:35











  • I find it frustrating that man 5 mtab is missing.

    – Weijun Zhou
    Apr 23 at 17:48






  • 2





    Also: unix.stackexchange.com/q/24182/117549

    – Jeff Schaller
    Apr 23 at 18:08

















  • Related: Is there a command to see where a disk is mounted?

    – Kusalananda
    Apr 23 at 17:35











  • I find it frustrating that man 5 mtab is missing.

    – Weijun Zhou
    Apr 23 at 17:48






  • 2





    Also: unix.stackexchange.com/q/24182/117549

    – Jeff Schaller
    Apr 23 at 18:08
















Related: Is there a command to see where a disk is mounted?

– Kusalananda
Apr 23 at 17:35





Related: Is there a command to see where a disk is mounted?

– Kusalananda
Apr 23 at 17:35













I find it frustrating that man 5 mtab is missing.

– Weijun Zhou
Apr 23 at 17:48





I find it frustrating that man 5 mtab is missing.

– Weijun Zhou
Apr 23 at 17:48




2




2





Also: unix.stackexchange.com/q/24182/117549

– Jeff Schaller
Apr 23 at 18:08





Also: unix.stackexchange.com/q/24182/117549

– Jeff Schaller
Apr 23 at 18:08










2 Answers
2






active

oldest

votes


















46














% file /etc/mtab
/etc/mtab: symbolic link to ../proc/self/mounts
% file /proc/mounts
/proc/mounts: symbolic link to self/mounts
%


/etc/mtab is a compatibility mechanism. Decades ago, Unix did not have a system call for reading the existing mount information. Instead, programs that mounted filesystems were expected to coöperatively and voluntarily maintain a table in /etc/mtab of what was mounted where.



For obvious reasons, this was not an ideal mechanism.



Linux gained the notion of a "procfs", and one of the things that it gained was a kernel-maintained version of this table, in the form of a mounts pseudo-regular file. The "system call" to read the mount information out of the kernel became an open-read-close sequence against that file, followed by parsing the result from human-readable to machine-readable form (something that has some subtle catches, as you can see from the bug reports from just over a fortnight ago).



/etc/mtab thus has popularly become a symbolic link to /proc/mounts, allowing programs that had hardwired that name to keep reading a mount table from that file, which the programs that mounted and unmounted filesystems no longer have to explicitly do anything themselves to keep up to date. (Some of them still will, though, if /etc/mtab turns out to be a writable regular file. And there are a few corner cases where the normalized information in mounts that lacks all non-kernel stuff is not quite what is needed; although they do not outweigh the general problems with /etc/mtab.)



Each process can nowadays have its own individual view of what is mounted, and there are as a consequence now individual mounts files for each process in the procfs, each process's own table being accessible to it via the self symbolic link as self/mounts, and /proc/mounts is also now a compatibility mechanism. (Interestingly, neither per-process mounts nor the format of mounts are documented in the current Linux doco, although the similar mountinfo pseudo-regular file is.)



SunOS/Solaris has a similar mechanism. The /etc/mnttab file is actually a single-file filesystem, and in addition to reading the table, via an open file descriptor to that file, with the read() system call, one can watch for mount point changes with poll() and obtain various further pieces of information with ioctl().



In HP-UX, /etc/mnttab is likewise the name of the file, but as of version 11 it was still a regular file whose contents were coöperatively maintained by the system utility programs.



AIX does not export a human-readable text table that programs have to parse, and there is no equivalent file. The BSDs, similarly, have fully-fledged system calls, getfsstat() on FreeBSD and OpenBSD, for programs to obtain the mount table from the kernel in machine-readable form without marshalling it through a human-readable intermediate form.



Further reading



  • Zygmunt Krynicki (2019-03-16). r in path confuses mount units. #12018. systemd issues.

  • Zbigniew Jędrzejewski-Szmek (2019-04-04). [df] incorrect parsing of /proc/self/mountinfo with r in mount path. #35137. GNU coreutils bugs.


  • /proc/mounts. Documentation/filesystems/proc.txt. Linux 5.1.

  • Jonathan de Boyne Pollard (2019-02-28). Re: what is the purpose of fstab-decode. Bug #567071. Debian bugs.


  • getfsstat(). FreeBSD System Calls Manual. 2016-12-27.





share|improve this answer

























  • In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

    – Weijun Zhou
    Apr 23 at 19:20






  • 2





    not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

    – mosvy
    Apr 24 at 2:35












  • though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

    – mosvy
    Apr 24 at 3:08












  • I know pseudo files and regular files, but what is a pseudo regular file?

    – gerrit
    2 days ago











  • @gerrit it's a regular file which has size 0 but still contains data ;-)

    – mosvy
    2 days ago


















11














According to man mount:




The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features.




On mounting without recording in /etc/mtab:




-n, --no-mtab



Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem.




Many more nuances are given in the manual page.






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Sathish kumar is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f514078%2fwhat-is-etc-mtab-in-linux%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    46














    % file /etc/mtab
    /etc/mtab: symbolic link to ../proc/self/mounts
    % file /proc/mounts
    /proc/mounts: symbolic link to self/mounts
    %


    /etc/mtab is a compatibility mechanism. Decades ago, Unix did not have a system call for reading the existing mount information. Instead, programs that mounted filesystems were expected to coöperatively and voluntarily maintain a table in /etc/mtab of what was mounted where.



    For obvious reasons, this was not an ideal mechanism.



    Linux gained the notion of a "procfs", and one of the things that it gained was a kernel-maintained version of this table, in the form of a mounts pseudo-regular file. The "system call" to read the mount information out of the kernel became an open-read-close sequence against that file, followed by parsing the result from human-readable to machine-readable form (something that has some subtle catches, as you can see from the bug reports from just over a fortnight ago).



    /etc/mtab thus has popularly become a symbolic link to /proc/mounts, allowing programs that had hardwired that name to keep reading a mount table from that file, which the programs that mounted and unmounted filesystems no longer have to explicitly do anything themselves to keep up to date. (Some of them still will, though, if /etc/mtab turns out to be a writable regular file. And there are a few corner cases where the normalized information in mounts that lacks all non-kernel stuff is not quite what is needed; although they do not outweigh the general problems with /etc/mtab.)



    Each process can nowadays have its own individual view of what is mounted, and there are as a consequence now individual mounts files for each process in the procfs, each process's own table being accessible to it via the self symbolic link as self/mounts, and /proc/mounts is also now a compatibility mechanism. (Interestingly, neither per-process mounts nor the format of mounts are documented in the current Linux doco, although the similar mountinfo pseudo-regular file is.)



    SunOS/Solaris has a similar mechanism. The /etc/mnttab file is actually a single-file filesystem, and in addition to reading the table, via an open file descriptor to that file, with the read() system call, one can watch for mount point changes with poll() and obtain various further pieces of information with ioctl().



    In HP-UX, /etc/mnttab is likewise the name of the file, but as of version 11 it was still a regular file whose contents were coöperatively maintained by the system utility programs.



    AIX does not export a human-readable text table that programs have to parse, and there is no equivalent file. The BSDs, similarly, have fully-fledged system calls, getfsstat() on FreeBSD and OpenBSD, for programs to obtain the mount table from the kernel in machine-readable form without marshalling it through a human-readable intermediate form.



    Further reading



    • Zygmunt Krynicki (2019-03-16). r in path confuses mount units. #12018. systemd issues.

    • Zbigniew Jędrzejewski-Szmek (2019-04-04). [df] incorrect parsing of /proc/self/mountinfo with r in mount path. #35137. GNU coreutils bugs.


    • /proc/mounts. Documentation/filesystems/proc.txt. Linux 5.1.

    • Jonathan de Boyne Pollard (2019-02-28). Re: what is the purpose of fstab-decode. Bug #567071. Debian bugs.


    • getfsstat(). FreeBSD System Calls Manual. 2016-12-27.





    share|improve this answer

























    • In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

      – Weijun Zhou
      Apr 23 at 19:20






    • 2





      not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

      – mosvy
      Apr 24 at 2:35












    • though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

      – mosvy
      Apr 24 at 3:08












    • I know pseudo files and regular files, but what is a pseudo regular file?

      – gerrit
      2 days ago











    • @gerrit it's a regular file which has size 0 but still contains data ;-)

      – mosvy
      2 days ago















    46














    % file /etc/mtab
    /etc/mtab: symbolic link to ../proc/self/mounts
    % file /proc/mounts
    /proc/mounts: symbolic link to self/mounts
    %


    /etc/mtab is a compatibility mechanism. Decades ago, Unix did not have a system call for reading the existing mount information. Instead, programs that mounted filesystems were expected to coöperatively and voluntarily maintain a table in /etc/mtab of what was mounted where.



    For obvious reasons, this was not an ideal mechanism.



    Linux gained the notion of a "procfs", and one of the things that it gained was a kernel-maintained version of this table, in the form of a mounts pseudo-regular file. The "system call" to read the mount information out of the kernel became an open-read-close sequence against that file, followed by parsing the result from human-readable to machine-readable form (something that has some subtle catches, as you can see from the bug reports from just over a fortnight ago).



    /etc/mtab thus has popularly become a symbolic link to /proc/mounts, allowing programs that had hardwired that name to keep reading a mount table from that file, which the programs that mounted and unmounted filesystems no longer have to explicitly do anything themselves to keep up to date. (Some of them still will, though, if /etc/mtab turns out to be a writable regular file. And there are a few corner cases where the normalized information in mounts that lacks all non-kernel stuff is not quite what is needed; although they do not outweigh the general problems with /etc/mtab.)



    Each process can nowadays have its own individual view of what is mounted, and there are as a consequence now individual mounts files for each process in the procfs, each process's own table being accessible to it via the self symbolic link as self/mounts, and /proc/mounts is also now a compatibility mechanism. (Interestingly, neither per-process mounts nor the format of mounts are documented in the current Linux doco, although the similar mountinfo pseudo-regular file is.)



    SunOS/Solaris has a similar mechanism. The /etc/mnttab file is actually a single-file filesystem, and in addition to reading the table, via an open file descriptor to that file, with the read() system call, one can watch for mount point changes with poll() and obtain various further pieces of information with ioctl().



    In HP-UX, /etc/mnttab is likewise the name of the file, but as of version 11 it was still a regular file whose contents were coöperatively maintained by the system utility programs.



    AIX does not export a human-readable text table that programs have to parse, and there is no equivalent file. The BSDs, similarly, have fully-fledged system calls, getfsstat() on FreeBSD and OpenBSD, for programs to obtain the mount table from the kernel in machine-readable form without marshalling it through a human-readable intermediate form.



    Further reading



    • Zygmunt Krynicki (2019-03-16). r in path confuses mount units. #12018. systemd issues.

    • Zbigniew Jędrzejewski-Szmek (2019-04-04). [df] incorrect parsing of /proc/self/mountinfo with r in mount path. #35137. GNU coreutils bugs.


    • /proc/mounts. Documentation/filesystems/proc.txt. Linux 5.1.

    • Jonathan de Boyne Pollard (2019-02-28). Re: what is the purpose of fstab-decode. Bug #567071. Debian bugs.


    • getfsstat(). FreeBSD System Calls Manual. 2016-12-27.





    share|improve this answer

























    • In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

      – Weijun Zhou
      Apr 23 at 19:20






    • 2





      not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

      – mosvy
      Apr 24 at 2:35












    • though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

      – mosvy
      Apr 24 at 3:08












    • I know pseudo files and regular files, but what is a pseudo regular file?

      – gerrit
      2 days ago











    • @gerrit it's a regular file which has size 0 but still contains data ;-)

      – mosvy
      2 days ago













    46












    46








    46







    % file /etc/mtab
    /etc/mtab: symbolic link to ../proc/self/mounts
    % file /proc/mounts
    /proc/mounts: symbolic link to self/mounts
    %


    /etc/mtab is a compatibility mechanism. Decades ago, Unix did not have a system call for reading the existing mount information. Instead, programs that mounted filesystems were expected to coöperatively and voluntarily maintain a table in /etc/mtab of what was mounted where.



    For obvious reasons, this was not an ideal mechanism.



    Linux gained the notion of a "procfs", and one of the things that it gained was a kernel-maintained version of this table, in the form of a mounts pseudo-regular file. The "system call" to read the mount information out of the kernel became an open-read-close sequence against that file, followed by parsing the result from human-readable to machine-readable form (something that has some subtle catches, as you can see from the bug reports from just over a fortnight ago).



    /etc/mtab thus has popularly become a symbolic link to /proc/mounts, allowing programs that had hardwired that name to keep reading a mount table from that file, which the programs that mounted and unmounted filesystems no longer have to explicitly do anything themselves to keep up to date. (Some of them still will, though, if /etc/mtab turns out to be a writable regular file. And there are a few corner cases where the normalized information in mounts that lacks all non-kernel stuff is not quite what is needed; although they do not outweigh the general problems with /etc/mtab.)



    Each process can nowadays have its own individual view of what is mounted, and there are as a consequence now individual mounts files for each process in the procfs, each process's own table being accessible to it via the self symbolic link as self/mounts, and /proc/mounts is also now a compatibility mechanism. (Interestingly, neither per-process mounts nor the format of mounts are documented in the current Linux doco, although the similar mountinfo pseudo-regular file is.)



    SunOS/Solaris has a similar mechanism. The /etc/mnttab file is actually a single-file filesystem, and in addition to reading the table, via an open file descriptor to that file, with the read() system call, one can watch for mount point changes with poll() and obtain various further pieces of information with ioctl().



    In HP-UX, /etc/mnttab is likewise the name of the file, but as of version 11 it was still a regular file whose contents were coöperatively maintained by the system utility programs.



    AIX does not export a human-readable text table that programs have to parse, and there is no equivalent file. The BSDs, similarly, have fully-fledged system calls, getfsstat() on FreeBSD and OpenBSD, for programs to obtain the mount table from the kernel in machine-readable form without marshalling it through a human-readable intermediate form.



    Further reading



    • Zygmunt Krynicki (2019-03-16). r in path confuses mount units. #12018. systemd issues.

    • Zbigniew Jędrzejewski-Szmek (2019-04-04). [df] incorrect parsing of /proc/self/mountinfo with r in mount path. #35137. GNU coreutils bugs.


    • /proc/mounts. Documentation/filesystems/proc.txt. Linux 5.1.

    • Jonathan de Boyne Pollard (2019-02-28). Re: what is the purpose of fstab-decode. Bug #567071. Debian bugs.


    • getfsstat(). FreeBSD System Calls Manual. 2016-12-27.





    share|improve this answer















    % file /etc/mtab
    /etc/mtab: symbolic link to ../proc/self/mounts
    % file /proc/mounts
    /proc/mounts: symbolic link to self/mounts
    %


    /etc/mtab is a compatibility mechanism. Decades ago, Unix did not have a system call for reading the existing mount information. Instead, programs that mounted filesystems were expected to coöperatively and voluntarily maintain a table in /etc/mtab of what was mounted where.



    For obvious reasons, this was not an ideal mechanism.



    Linux gained the notion of a "procfs", and one of the things that it gained was a kernel-maintained version of this table, in the form of a mounts pseudo-regular file. The "system call" to read the mount information out of the kernel became an open-read-close sequence against that file, followed by parsing the result from human-readable to machine-readable form (something that has some subtle catches, as you can see from the bug reports from just over a fortnight ago).



    /etc/mtab thus has popularly become a symbolic link to /proc/mounts, allowing programs that had hardwired that name to keep reading a mount table from that file, which the programs that mounted and unmounted filesystems no longer have to explicitly do anything themselves to keep up to date. (Some of them still will, though, if /etc/mtab turns out to be a writable regular file. And there are a few corner cases where the normalized information in mounts that lacks all non-kernel stuff is not quite what is needed; although they do not outweigh the general problems with /etc/mtab.)



    Each process can nowadays have its own individual view of what is mounted, and there are as a consequence now individual mounts files for each process in the procfs, each process's own table being accessible to it via the self symbolic link as self/mounts, and /proc/mounts is also now a compatibility mechanism. (Interestingly, neither per-process mounts nor the format of mounts are documented in the current Linux doco, although the similar mountinfo pseudo-regular file is.)



    SunOS/Solaris has a similar mechanism. The /etc/mnttab file is actually a single-file filesystem, and in addition to reading the table, via an open file descriptor to that file, with the read() system call, one can watch for mount point changes with poll() and obtain various further pieces of information with ioctl().



    In HP-UX, /etc/mnttab is likewise the name of the file, but as of version 11 it was still a regular file whose contents were coöperatively maintained by the system utility programs.



    AIX does not export a human-readable text table that programs have to parse, and there is no equivalent file. The BSDs, similarly, have fully-fledged system calls, getfsstat() on FreeBSD and OpenBSD, for programs to obtain the mount table from the kernel in machine-readable form without marshalling it through a human-readable intermediate form.



    Further reading



    • Zygmunt Krynicki (2019-03-16). r in path confuses mount units. #12018. systemd issues.

    • Zbigniew Jędrzejewski-Szmek (2019-04-04). [df] incorrect parsing of /proc/self/mountinfo with r in mount path. #35137. GNU coreutils bugs.


    • /proc/mounts. Documentation/filesystems/proc.txt. Linux 5.1.

    • Jonathan de Boyne Pollard (2019-02-28). Re: what is the purpose of fstab-decode. Bug #567071. Debian bugs.


    • getfsstat(). FreeBSD System Calls Manual. 2016-12-27.






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 2 days ago

























    answered Apr 23 at 19:16









    JdeBPJdeBP

    38.9k480187




    38.9k480187












    • In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

      – Weijun Zhou
      Apr 23 at 19:20






    • 2





      not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

      – mosvy
      Apr 24 at 2:35












    • though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

      – mosvy
      Apr 24 at 3:08












    • I know pseudo files and regular files, but what is a pseudo regular file?

      – gerrit
      2 days ago











    • @gerrit it's a regular file which has size 0 but still contains data ;-)

      – mosvy
      2 days ago

















    • In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

      – Weijun Zhou
      Apr 23 at 19:20






    • 2





      not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

      – mosvy
      Apr 24 at 2:35












    • though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

      – mosvy
      Apr 24 at 3:08












    • I know pseudo files and regular files, but what is a pseudo regular file?

      – gerrit
      2 days ago











    • @gerrit it's a regular file which has size 0 but still contains data ;-)

      – mosvy
      2 days ago
















    In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

    – Weijun Zhou
    Apr 23 at 19:20





    In complement with my comment in the question here is the mtab(5) from the old days: man.cat-v.org/unix_8th/5/mtab.

    – Weijun Zhou
    Apr 23 at 19:20




    2




    2





    not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

    – mosvy
    Apr 24 at 2:35






    not only /proc/mounts, but /proc/self/mounts is itself a compatibility mechanism now; it's only showing a subset of the info available in /proc/self/mountinfo. The format of /proc/self/mounts is documented in proc(5) as identical to fstab(5)

    – mosvy
    Apr 24 at 2:35














    though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

    – mosvy
    Apr 24 at 3:08






    though admittedly, fstab(5) only tells about spaces being replaced by octal escapes, while it's spaces, tabs, newlines and backslashes

    – mosvy
    Apr 24 at 3:08














    I know pseudo files and regular files, but what is a pseudo regular file?

    – gerrit
    2 days ago





    I know pseudo files and regular files, but what is a pseudo regular file?

    – gerrit
    2 days ago













    @gerrit it's a regular file which has size 0 but still contains data ;-)

    – mosvy
    2 days ago





    @gerrit it's a regular file which has size 0 but still contains data ;-)

    – mosvy
    2 days ago













    11














    According to man mount:




    The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features.




    On mounting without recording in /etc/mtab:




    -n, --no-mtab



    Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem.




    Many more nuances are given in the manual page.






    share|improve this answer



























      11














      According to man mount:




      The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features.




      On mounting without recording in /etc/mtab:




      -n, --no-mtab



      Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem.




      Many more nuances are given in the manual page.






      share|improve this answer

























        11












        11








        11







        According to man mount:




        The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features.




        On mounting without recording in /etc/mtab:




        -n, --no-mtab



        Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem.




        Many more nuances are given in the manual page.






        share|improve this answer













        According to man mount:




        The programs mount and umount traditionally maintained a list of currently mounted filesystems in the file /etc/mtab. This real mtab file is still supported, but on current Linux systems it is better to make it a symlink to /proc/mounts instead, because a regular mtab file maintained in userspace cannot reliably work with namespaces, containers and other advanced Linux features.




        On mounting without recording in /etc/mtab:




        -n, --no-mtab



        Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only filesystem.




        Many more nuances are given in the manual page.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 23 at 17:57









        ChristopherChristopher

        11k33350




        11k33350




















            Sathish kumar is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Sathish kumar is a new contributor. Be nice, and check out our Code of Conduct.












            Sathish kumar is a new contributor. Be nice, and check out our Code of Conduct.











            Sathish kumar is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f514078%2fwhat-is-etc-mtab-in-linux%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How does Billy Russo acquire his 'Jigsaw' mask? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why does Bane wear the mask?Why does Kylo Ren wear a mask?Why did Captain America remove his mask while fighting Batroc the Leaper?How did the OA acquire her wisdom?Is Billy Breckenridge gay?How does Adrian Toomes hide his earnings from the IRS?What is the state of affairs on Nootka Sound by the end of season 1?How did Tia Dalma acquire Captain Barbossa's body?How is one “Deemed Worthy”, to acquire the Greatsword “Dawn”?How did Karen acquire the handgun?

            Личност Атрибути на личността | Литература и източници | НавигацияРаждането на личносттаредактиратередактирате

            A sequel to Domino's tragic life Why Christmas is for Friends Cold comfort at Charles' padSad farewell for Lady JanePS Most watched News videos