LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-06-2009, 09:27 AM   #1
GDarkBladE
Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 38

Rep: Reputation: 17
Bad entries in /proc/mounts


I have some bad entries that keep popping up in /proc/mounts. Somehow there are links from /dev/sdb in /media/ that were created very early in setting up this system when I used a sata>usb adapter to copy files from my old hard drive. That resulted in /media/usb1 usb2 and usb3. What happens now is at random on boot the system will somehow decide that /dev/sdb1, my 2nd hard drive, should be mounted at /media/usb1 instead of /mnt/Video2, which creates a real mess. The system is LinHES which is running on ArchLinux so when this happens it fails fsck and drops into maintenance mode.

The first time it happened I found the dirs in /media, but mount showed nothing but / mounted, so I remounted in rw and tried to delete the dirs. It hung up for awhile so I did a ctrl-c and then did an ls -al and found out that all 3 /media/usb# mount points were linked to /dev/sdb1. It was actually deleting all my videos off the drive! I finally forced it to unmount the drive and delete the dir's and it booted normally. The next time only /media/usb1 was there but again it was mounted to /dev/sdb1 and I couldn't make it unmount no matter what. I finally booted of a CD and deleted the mount point.

When it happens, mtab will show the invalid points, and /proc/mounts the same. I can delete mtab but it is recreated on boot identical to /proc/mounts. So obviously there is a file somewhere that is holding this bad information and the kernel is using it to populate /proc/mounts early in the boot process, but I've searched everywhere for sdb1 and /media/usb1 and so far haven't found anything. Does anyone have a clue where /proc/mounts gets its info and why these non-existent old mounts keep getting recreated?
 
Old 08-01-2009, 07:11 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,744
Blog Entries: 54

Rep: Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973
Sounds like HAL to me if that's enough of a hint for you.
 
Old 08-02-2009, 09:47 AM   #3
GDarkBladE
Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 38

Original Poster
Rep: Reputation: 17
It's udev. The LinHES maintainers just updated hal and udev and disabled auto mounting because it's been causing failed installs and data corruption on installs with dual hard drives. I rolled udev back so I could continue using automount until I get time to work up my own rules for my drives.

Just the other night our power went off and I had to quick shut down the PC while my USB drive was still plugged in. When I powered back up with it disconnected it again mounted /dev/sdb1 in the leftover /media/usb1 directory and I had to umount it and then remove the directory, fsck sdb1 and delete mtab. Then it booted fine. So apparently on boot, if udev sees any directories in /media it decides something has to be mounted there so it mounts the 2nd usable partition it finds there.
 
Old 08-03-2009, 03:20 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,744
Blog Entries: 54

Rep: Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973
Quote:
Originally Posted by GDarkBladE View Post
It's udev.
HAL makes removable media accessable as a /media/.* entry. "userspace device" manages /dev nodes.
 
Old 08-04-2009, 08:45 AM   #5
GDarkBladE
Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 38

Original Poster
Rep: Reputation: 17
That's true but after the update I rolled hal back and automount didn't work so I updated it again. Then I rolled udev back and auto mounting worked again, but my problem occurred again on boot when the usb directories were still in /media on boot. So naturally I assumed that something in udev was causing the problem. The root of the problem may simply be that a cleaner script is needed to umount and rmdir everything in /media on initial boot,

I updated udev again and wrote this rule in /etc/udev/rules.d to only trigger on usb devices and I deliberately started at sdc instead of sdb so it will ignore my 2nd hard drive. It seems to work, mounts the usb drives by their disk label and removes them on disconnect. I'd like someone else to try it and suggest any needed tweaks or corrections.

KERNEL=="sd[c-z]", SUBSYSTEMS=="usb", NAME="%k", SYMLINK+="usb%m", GROUP="users"
ACTION=="add", KERNEL=="sd[c-z][0-9]", SYMLINK+="usb%n", GROUP="users", NAME="%k"
ACTION=="add", KERNEL=="sd[c-z][0-9]", RUN+="/bin/mkdir -p /media/$env{ID_FS_LABEL}"
ACTION=="add", KERNEL=="sd[c-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,noatime /dev/%k /media/$env{ID_FS_LABEL}"
ACTION=="remove", KERNEL=="sd[c-z][0-9]", RUN+="/bin/umount -l /media/$env{ID_FS_LABEL}"
ACTION=="remove", KERNEL=="sd[c-z][0-9]", RUN+="/bin/rmdir /media/$env{ID_FS_LABEL}"
 
Old 08-04-2009, 09:46 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,744
Blog Entries: 54

Rep: Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973
Definately nice but I still don't think that's right. Example: when running a certain distro more famous for its users herd behaviour, unquestionable faith and idolatry than anything else, running your ruleset makes me loose all /media entries plus it makes mountpoints for all toplevel directories inside the mounted storage device. Udev by default has rules to populate /dev for removable mass storage devices and as I said before /media isn't governed by Udev but by HAL: meaning (AFAIK) any rules concerning /media should be in /usr/share/hal/fdi/.*/.*\.fdi configuration files.
 
Old 08-04-2009, 09:56 AM   #7
GDarkBladE
Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 38

Original Poster
Rep: Reputation: 17
It is entirely dependent on the distro and how the packages are built. LinHES is based on ArchLinux and at it's current stage relies on the rules in /etc/udev/rules.d, but other distros that are using a more complete build of HAL the rules should be in the fdi files.
 
Old 08-04-2009, 10:09 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,744
Blog Entries: 54

Rep: Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973Reputation: 2973
Thanks for explaining. If it works for you then it's definately good.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
filesystems in /proc/mounts are ro dindome Linux - Hardware 1 06-24-2008 05:51 AM
/etc/mtab vs. /proc/self/mounts ciotog Slackware 1 10-10-2005 05:31 AM
About /proc/mounts A-Liang Programming 3 11-27-2004 10:52 PM
/proc/mounts and /etc/mtab differs pradi_net Linux - Software 0 05-19-2004 10:47 AM
Help! /proc/mounts not found during bootup artemis Linux - General 15 11-10-2003 04:31 AM


All times are GMT -5. The time now is 12:57 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration