You are not logged in.

#1 2011-05-16 06:20:57

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

not[SOLVED], but closed for now: Local partitions mounted as USB

Just now something incredibly weird happened:
I plugged an external card-reader into my machine to check someone's SD-card. It came up with six or seven usbhd-0x drives mounted under /media (I auto-mount with udev). I didn't think anything of it, as it has six or seven different slots and shows the same behaviour under Windows.
When I navigated there however, they didn't show the content of the SD card, but rather the contents of my /boot, root, and /home partition. As I had done a backup of my partitions a few days ago I thought that there may have been some remnants from a bad umount and, as I was in a hurry, just unplugged the card-reader and deleted the still present partitions under /media as root. A probably rather crude brute-force technique that has worked before for some stubborn mounts without trouble.
To my horror however, I quickly realised that I was in fact deleting my local files.

Now, I don't really mind having lost all my data, as I have a recent backup and it's probably about time again for a fresh install but I'd quite like to know what happened here so that I can avoid such a mistake in future.

Does anyone have a clue as to what might have been the cause of this rather strange mounting error?

Thanks in advance

Last edited by JackH79 (2011-05-17 07:40:31)

Offline

#2 2011-05-16 07:49:12

xduugu
Member
Registered: 2008-10-16
Posts: 292

Re: not[SOLVED], but closed for now: Local partitions mounted as USB

Actually, this particular udev rule mounts every device that pops up as sd[a-z]* in dev. So not just usb devices, but they are likely the common case.

I have also encountered the behaviour you describe just yesterday, but did not had the time to track it down so far. This happened before, but was fixed by the line you may see in your udev rule:

# Do not mount devices on boot because otherwise fsck may fail
ACTION=="add", PROGRAM!="/bin/grep -q ' / / rw[, ]' /proc/self/mountinfo", GOTO="media_by_label_auto_mount_end"

But recently, something changed in the boot process or it was the udev update, and now this line does not catch the boot process anymore. This leads to the situation that every local device is mounted under /media as well as the usual plugged-in usb devices. My quick fix was excluding my harddrive (just sda) from the kernel device pattern in the first line:

KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"

to

KERNEL!="sd[b-z]*", GOTO="media_by_label_auto_mount_end"

Notice that sd[a-z]* was changed to sd[b-z]*.

Offline

#3 2011-05-16 15:34:14

xduugu
Member
Registered: 2008-10-16
Posts: 292

Re: not[SOLVED], but closed for now: Local partitions mounted as USB

Might have found a more generic fix. At least it works for me™.

Replace

ACTION=="add", PROGRAM!="/bin/grep -q ' / / rw[, ]' /proc/self/mountinfo", GOTO="media_by_label_auto_mount_end"

with

ACTION=="add", PROGRAM=="/bin/grep -q ' /dev/%k ' /proc/self/mountinfo", GOTO="media_by_label_auto_mount_end"

or add it near the head of the file. Around third line or so.

Offline

#4 2011-05-17 07:38:21

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: not[SOLVED], but closed for now: Local partitions mounted as USB

Thanks very much xduugu. Nice to know one is not alone ... wink
I did actually have the "sd[b-z]*" rule in my rules. I'll try your work around.
Not sure if I can report back though, as my last install lasted for about two years before I ran this little snag.
Anyway, thanks again for sharing.

Offline

Board footer

Powered by FluxBB