Skip to contentSkip to conversation

Unmounting a busy RO-Filesystem

DISCUSSION Bourne 3 participants 3 messages Dec 16, 2002

lore
Share & tools
lore

Bourne

author
#0 lore raw

I have 3 partitions. /dev/hda3 for '/' , /dev/hda1 for /boot and /dev/hda2 for swap.

I boot & then i do a CTRL+ALT+SYSRQ+U. '/' and '/boot' are now remounted ReadOnly.

1) cd '/boot'
2) umount /boot ----> This gives me an error "Device Busy"
3) cd /
4) umount / -------> No error
5) echo $? -----> outputs '0' indicating success. !!!!!!!!

When i do the above by skipping the Sysrq part, i get the usual expected errors.

So is the above behaviour expected ? I tried this on 2.4.19 & 2.5.51. Same results.

I am subscribed to the list

TIA
Bourne

#1 lore raw
Quoted 8 lines · Bourne

I have 3 partitions. /dev/hda3 for '/' , /dev/hda1 for /boot and /dev/hda2 for swap.

I boot & then i do a CTRL+ALT+SYSRQ+U. '/' and '/boot' are now remounted ReadOnly.

1) cd '/boot'
2) umount /boot ----> This gives me an error "Device Busy"

How do you imagine unmounting a directory when you are in it? ;)

Quoted 2 lines

3) cd /
4) umount / -------> No error

This is special case: "umount /" == "mount -o remount,ro /"

Quoted 4 lines

5) echo $? -----> outputs '0' indicating success. !!!!!!!!

When i do the above by skipping the Sysrq part, i get the usual expected errors.

Without SysRq,

# mount -o remount,ro /

fails 'coz you have files open for writing.
You might ask how kernel can do that ro remount with SysRq? It cheats! ;)
--
vda

#2 lore raw
Quoted 9 lines · Denis Vlasenko
Quoted 6 lines · Bourne

I have 3 partitions. /dev/hda3 for '/' , /dev/hda1 for /boot and /dev/hda2 for swap.

I boot & then i do a CTRL+ALT+SYSRQ+U. '/' and '/boot' are now remounted ReadOnly.

Quoted 8 lines
Quoted 4 lines

1) cd '/boot'
2) umount /boot ----> This gives me an error "Device Busy"

How do you imagine unmounting a directory when you are in it? ;)

This is possible with a kernel patch called forced unmount. It will blow away the mount point even if there are files open in it or not. The best part is it properly closes the superblock so the filesystem doesn't have to be fsck'ed.

Quoted 2 lines