Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
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.
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.
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.