LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Question about mounting (https://www.linuxquestions.org/questions/linux-newbie-8/question-about-mounting-4175556527/)

kiraan 10-18-2015 08:29 PM

Question about mounting
 
Hi,

In Linux systems permanent mounting is done by adding an entry is /etc/fstab. Can anyone tell which files stores information about temporary mount.

For example :
If I mount /dev/sdb1 to /test1 using below command :

mount /dev/sdb1 /test1

Which file will store this mount information.

Thank you.

syg00 10-18-2015 08:41 PM

Read the manpage for mount.

kiraan 10-18-2015 08:54 PM

Quote:

Originally Posted by syg00 (Post 5436593)
Read the manpage for mount.

Thanks. It is /etc/mtab.

syg00 10-18-2015 08:56 PM

Not really. Read it again, and run this
Code:

ls -l /etc/mtab

kiraan 10-18-2015 09:15 PM

Is it /etc/mtab.tmp

[root@localhost ~]# ls -l /etc/mtab
-rw-r--r-- 1 root root 193 Aug 12 19:48 /etc/mtab
[root@localhost ~]#

syg00 10-18-2015 09:39 PM

Interesting. What distro and kernel (uname -a) are you running ?.

berndbausch 10-18-2015 09:44 PM

Quote:

Originally Posted by kiraan (Post 5436596)
Thanks. It is /etc/mtab.

/etc/mtab doesn't seem to contain everything. On my system, I see the following difference:

Code:

$ cat /etc/mtab
....
/dev/loop0 /var/wwwapa/ubuntuinstall iso9660 ro,relatime 0 0
/dev/loop0 /srv/tftp/pxelinux/install iso9660 ro,relatime 0 0
/dev/loop0 /srv/tftp/pxelinux/preseed iso9660 ro,relatime 0 0
$
$ mount
...
/srv/ubuntu-14.04.2-server-amd64.iso on /var/wwwapa/ubuntuinstall type iso9660 (ro,relatime)
/srv/ubuntu-14.04.2-server-amd64.iso on /srv/tftp/pxelinux/install type iso9660 (ro,relatime)
/srv/ubuntu-14.04.2-server-amd64.iso on /srv/tftp/pxelinux/preseed type iso9660 (ro,relatime)

Full information about temporary mounts is kept in the kernel, not necessarily a file. Why do you need a file anyway? The mount command, without parameters, dumps out the mount table just fine.

Emerson 10-18-2015 09:46 PM

Until very recently in Gentoo mtab was a real file, for instance.

chrism01 10-19-2015 03:05 AM

On my Centos 6.7, /etc/mtab is a real file, but as its updated by the kernel, you shouldn't mess with it.
Also, the content lists the same mount pts, but in a different format, from that returned by 'mount' .

rknichols 10-19-2015 07:16 AM

Quote:

Originally Posted by chrism01 (Post 5436719)
On my Centos 6.7, /etc/mtab is a real file, but as its updated by the kernel, you shouldn't mess with it.

A real file /etc/mtab is not updated by the kernel. It is updated by the mount command itself. If you want to see what the kernel holds internally, look at /proc/mounts .

zhjim 10-19-2015 07:34 AM

Check /proc/mounts


All times are GMT -5. The time now is 02:32 PM.