Device already mounted or mountpoint busy

Device already mounted or mountpoint busy

Originally posted to my blogspot blog.

First post in too long. The muse hasn't really grabbed me strongly enough to warrant additional entertainment for my tiny readership. Still, I won't give it up!

So here's a quickie technical post. I powered on my Ubuntu 9.10-powered computer the other day. When I logged in, I found that my home directory didn't exist, and was dropped into the root directory.

I mounted it manually, and everything looked okay. Assuming it was just some fluke, I rebooted the machine to make sure it would auto-mount correctly. It failed again. This time, manual mounting didn't work.

My home directory actually lives on /dev/md0, which is a Linux software RAID1 (mirror) device. I checked, and the device existed, and the array state was good:

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda1[1] sdb1[0]
      976759936 blocks [2/2] [UU]

      unused devices:

Still, the manual mount failed:

# mount /dev/md0 /mnt/share
mount: /dev/md0 already mounted or /mnt/share busy

Huh? I ran the mount command with no options: neither /dev/md0 nor /mnt/share was listed anywhere. I ran lsof: neither of those files were listed as open.

I even tried mounting in a new directory:

# mkdir /mnt/tmp
# mount /dev/md0 /mnt/tmp
mount: /dev/md0 already mounted or /mnt/tmp busy

Well, clearly /mnt/tmp isn't busy, as it was just created! So what was wrong with md0?

At this point, I started to get a little worried, so did the sanity test to make sure my data was still there:

# mount -t ext3 /dev/sda1 /mnt/share
mount: /dev/sda1 already mounted or /mnt/share busy

I tried the same thing with /dev/sdb1, the mirror of sda1 in the RAID1. Same result. At this point, I was more than worried, but not yet panicked.

I checked dmesg, to see if there were any obvious problems. Nope. So then I went into /var/log, and started looking at those files for clues. I finally found something:

EXT3-fs warning: mounting fs with errors, running e2fsck is recommended

Ah-hah! So I ran e2fsck on /dev/md0, and corrected the errors. I was then able to manually mount my home directory. I rebooted, again to make sure it came up, and it did.

I don't know if this is considered a mount bug or not, but the error message is extremely misleading.