/dev/… is apparently in use by the system; will not make a filesystem here!

September 15, 2009 at 6:42 pm (Linux)

Sometime, I end up with these tiny nuggets of knowledge that I know for a fact I will forget shortly. Moreover, when a Google search turn out to confirm that this nugget of knowledge is not part of the collective hive mind yet, I know for a fact I need to do something about it. I could keep it in a flat file or some sort of personal database or brainmap somewhere on my machine, but then I will certainly lose it. I am messy like that. However, if I post it on the intarweb, Google will eventually index it, which mean that next time I Google the problem in question, I will surely stumble upon my own long-forgotten blog post. Call that “netsourcing memory”!

So, while playing around a bunch of HP servers today, swapping drives around and making new logical ones, I stumbled upon that problem:


cloudmaster@uec-frontend:~$ sudo mkfs.ext4 /dev/cciss/c0d2p1
/dev/cciss/c0d2p1 is apparently in use by the system; will not make a filesystem here!

I tried with -FF (“Do as I say, you stupid!”), but it would still refuse to obtemperate. Confirmed with mount and fuser that the partition was not in use, and indeed it was not. Check dmesg, but there was nothing in there.

Turned out there was a logical volume on that drive, and it did not get wiped out in the disk swap. If the same happen to you, you can check that the partition is indeed an LVM physical volume with the command “pvdisplay”. You will then be able to proceed to wipe the LVM data from the drive (lvdisplay, lvremove, vgdisplay, vgremove, pvdisplay, pvremove, etc). Zeroing out the drive with dd would probably also work. Then you can mkfs. There you stupid, I told you to do so as I said! :)

Permalink Leave a Comment