can't reformat encrypted filesystem

I have an encrypted filesystem that I’ve decided I don’t want encrypted anymore. Seems the easiest way to do this is simply reformat the filesystem, but I can’t. If I try to do it in YaST2 I get either system error code -3005 (unknown) or -3008 (apparently in use). When I try to do it from the command line I get:


frylock:/home/joel # umount /dev/sdb5
umount: /dev/sdb5: not mounted
frylock:/home/joel # mkfs -t ext4 /dev/sdb5
mke2fs 1.41.9 (22-Aug-2009)
/dev/sdb5 is apparently in use by the system; will not make a filesystem here!
frylock:/home/joel # 

It’s unmounted, I don’t know how to make it any less in use than that.

I can’t delete the partition because it’s not the last logical partition in the extended partition.

What do I do next?

You could try to boot to a live CD/DVD and then try mkfs.

Use parted magic
Downloads

I am not realy well aqaintenced to encrypted fses, but aren’t they mounted different (e.g. by a different device file, I see /dev/loop0 in several howtos)?

look with

mount

what is mounted, maybe you see something there.

HTH

As noted in the original post, the OS doesn’t think it’s mounted. I double-checked the mount output anyway:

frylock:~ # umount /dev/sdb5
umount: /dev/sdb5: not mounted
frylock:~ # mount |grep sdb5
frylock:~ # mkfs -t ext4 /dev/sdb5
mke2fs 1.41.9 (22-Aug-2009)
/dev/sdb5 is apparently in use by the system; will not make a filesystem here!
frylock:~ #

How could it be in use if it’s not mounted?

I did NOT suggest

mount | grep sdb5

I suggested

mount

to see if there is some loop0 or so.

I think I figured it out. Because of the encryption this partition was stilled tied up in the device-mapper. I ran

# cryptsetup remove /dev/mapper/cr_sdb5

and was then able to use /dev/sdb5 again.

Apparently YaST is smart enough to create these mappings, but it has trouble removing them.

This is what I tried to tell you. Either /dev/loop0 or /dev/mapper/… An encrypted fs is not mounted from the original partition, but from another device file.

The mount statement would have shown you if you had not insisted in narrowing your view to /dev/sdb5.

Well, then you could have just told me rather than being circumspect about it. Regardless, the problem wasn’t /dev/mapper/cr_sdb5 being mounted. Once I realized how the device-mapper worked, the first thing I did was make sure /dev/mapper/cr_sdb5 wasn’t mounted. It wasn’t, and I still couldn’t reformat the sdb5 partition. The solution was to remove the mapping, not umount it. So I don’t think your view was any less narrow than mine was. But if it makes you feel better to talk down to me like that so be it.

I told you I wasn’t sure, but I looked through some howtos and there were things like /dev/loop0. You apparently use another type of encryption. In any case, I asked for a mount and I got a* mount | grep*.

I may be a bit touchy, but it is not encouraging when one tries to help in ones spare time and even a simple question is not answered.

In any case, if it is because somewhere my remarks made you think about how the encryprion mechanism works or not, the case is solved and that is what it is all about.

Happy reformatting.