8

Does there exist any tool which can tell you what the fstab line for a mount should be? Ie. it looks at something which has been mounted manually and tells you the line which you would have to add to /etc/fstab to have the same mount be persistent.

I understand that this might have to be a 'heuristic', or in other words a guess, as to options etc. But it seems like it would nonetheless be very useful.

jwg
  • 181
  • 6

2 Answers2

9

You can see some information about currently mounted devices by looking at the contents of /etc/mtab (the syntax is quite similar to the one of /etc/fstab). You should find some useful information about mount options as well.

Otherwise, you can use a simple "fstab generator" like this one:

http://epistel.no/fstab/

Riccardo M.
  • 150
  • 1
  • 9
4

Have a look at /etc/mtab. It contains list of all currently mounted systems with their parameters. From what I see on my Ubuntu system those lines can be directly copied to /etc/fstab.

Another place worth looking is /proc/mounts.

dtoubelis
  • 4,579
  • 1
  • 28
  • 31
  • The advantage of `/proc/mounts` is that it is generated by the kernel and thus doesn't get out of sync with reality. The advantage of `/etc/mtab` is that it sometimes contains some additional details which the `mount` command keeps track of but the kernel does not keep track of. – kasperd Dec 08 '15 at 15:55