LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-09-2005, 10:55 AM   #1
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
/etc/mtab vs. /proc/self/mounts


I was reading through the man page for mount today, and noticed in the section about using the loop device that it's recommended to make /etc/mtab a symlink to /proc/mounts in order for umount to automatically free loop devices. Now I shut down every night and rarely use the loop device, but I'm also somewhat pedantic and would rather have things just right.

Now /proc/mounts is a symlink to /proc/self/mounts, so to follow the mount man page recommendation properly /etc/mtab should point there instead, but on examining the contents of both those files there are several minor differences:
Code:
bash-3.00# cat /etc/mtab
/dev/hda3 / reiserfs rw 0 0
/dev/hda5 /home reiserfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
and
Code:
bash-3.00# cat /proc/self/mounts
rootfs / rootfs rw 0 0
/dev/root / reiserfs rw 0 0
/dev/hda5 /home reiserfs rw 0 0
devpts /dev/pts devpts rw 0 0
proc /proc proc rw,nodiratime 0 0
sysfs /sys sysfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
Despite the differences (which suggests two different processes each acting on one of the files), is it still ok to change /etc/mtab to be a symlink, or is this not recommended (other than by the mount man page)? Or is there a way to remove /etc/mtab altogether (since the existence of /proc/self/mounts makes it redundant and it doesn't make sense to have it in /etc anyway)?
 
Old 10-10-2005, 04:31 AM   #2
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
Re: /etc/mtab vs. /proc/self/mounts

Quote:
Originally posted by ciotog
I was reading through the man page for mount today, and noticed in the section about using the loop device that it's recommended to make /etc/mtab a symlink to /proc/mounts in order for umount to automatically free loop devices. Now I shut down every night and rarely use the loop device, but I'm also somewhat pedantic and would rather have things just right.

Now /proc/mounts is a symlink to /proc/self/mounts, so to follow the mount man page recommendation properly /etc/mtab should point there instead, but on examining the contents of both those files there are several minor differences:
Code:
bash-3.00# cat /etc/mtab
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
and
Code:
bash-3.00# cat /proc/self/mounts
devpts /dev/pts devpts rw 0 0
Despite the differences (which suggests two different processes each acting on one of the files), is it still ok to change /etc/mtab to be a symlink, or is this not recommended (other than by the mount man page)? Or is there a way to remove /etc/mtab altogether (since the existence of /proc/self/mounts makes it redundant and it doesn't make sense to have it in /etc anyway)?
Most programs use /etc/mtab, so you can't delete it but you can symlink it to /proc/mounts
This way from what you see in your example you lose some information about mounting.
That is why the man page mention you won't be able to umount automatically loop devices.
you will have to do "losetup -d /dev/loopX"

I used /proc/mounts for a long time and didn't notice any "problem" other than the loop umounting (which is annoying if you
use it frequently)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
About /proc/mounts A-Liang Programming 3 11-27-2004 09:52 PM
/proc/mounts and /etc/mtab differs pradi_net Linux - Software 0 05-19-2004 09:47 AM
RH9 /proc/mounts boot failure!! calabash Linux - Newbie 6 02-17-2004 06:42 PM
Can't find file '/proc/mounts' TY2K4 Red Hat 1 01-10-2004 07:39 AM
Help! /proc/mounts not found during bootup artemis Linux - General 15 11-10-2003 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration