Skip to contentSkip to conversation

unmounting a filesystem mounted by /init (initramfs)

DISCUSSION Rafael Espíndola 2 participants 4 messages Jul 28, 2005 – Jul 29, 2005

lore
Share & tools
lore
#0 lore raw

I am trying to build a system that uses a unionfs as root. The init script is based on the one used by gentoo and uses initramfs. The problem is how to remount the unionfs constituents read only during halt.

cat /proc/mounts displays /dev/hda1 (ext2) mounted rw in /memory. The problem is that /memory is no longer visible after the init script did a chroot and a

mount -o remount,ro /dev/hda1

says that /dev/hda1 is not mounted!

does any anyone has an idea?

Thanks,
Rafael

#1 lore raw
Quoted 8 lines · you

I am trying to build a system that uses a unionfs as root. The init script is based on the one used by gentoo and uses initramfs. The problem is how to remount the unionfs constituents read only during halt.

cat /proc/mounts displays /dev/hda1 (ext2) mounted rw in /memory. The problem is that /memory is no longer visible after the init script did a chroot and a

"A chroot"? Better provide exact sequence of mounts, chroots which you execute. Otherwise people need to guess.

Quoted 5 lines

mount -o remount,ro /dev/hda1

says that /dev/hda1 is not mounted!

does any anyone has an idea?

Use lazy umount (umount -l) while fs is still visible --
vda

#2 lore raw
Quoted 2 lines · Denis Vlasenko

"A chroot"? Better provide exact sequence of mounts, chroots which you execute. Otherwise people need to guess.

The relevant commands are:

mount -t ext2 /dev/hda1 /memory
mount -t unionfs -o dirs=/memory /union mount -t squashfs /dev/hda2 /newroot unionctl /union --add --after 0 --mode ro /newroot chroot /union /sbin/init

The most promissing Idea I had till now is to move the ext2 mount and the unionctl past the point were /sbin/rc runs udevstart. I will try it as soon as possible.

Quoted 1 line

Use lazy umount (umount -l) while fs is still visible

The busybox umount doesn't support lazy unmount :(
Anyway, I don't think that this would work since the unionfs will be using the ext2 partition to the very end and there won't be a chance to unmount it.

Quoted 1 line

vda

Thank you very much,
Rafael

#3 lore raw
In reply to Denis Vlasenko
Quoted 1 line

Use lazy umount (umount -l) while fs is still visible

This works after all :)

I was I bit confused on how to remove the ext2 from the union but manage to do it. Then it was a simple matter of implementing lazy unmount in busybox.

Thank you very much,
Rafael