[Unionfs] Unable to remount the cf device.

Carlos Galisteo de Cabo cgalisteo at k-rolus.net
Tue Nov 7 05:56:41 EST 2006


 Hello. Let's see if someone could help me with my problem (probably caused by my incompetence).

 I'll explain the hole thing to see where is my mistake or if it's not possible to do what I'm trying to.

 I'm building an embedded (Debian) system that will boot from a Compact Flash.
 I've two squashfs images (romimg and cfgimg), the kernel image (2.6.15),  initrd and all the boot stuff inside the cf (hda1).

 I use mkinitramfs, so in my initrd script my mountroot() function goes through this steps:
    -Creates four dirs (/initrd,/cfgimg,/romimg and /ramdsk)
    -Mounts the cf (mount -t ext3 -o ro ${FLASHDEV} /initrd)
    -Creates loop and ramdisk devices (losetup /dev/loop1 /initrd/${ROMIMG};losetup /dev/loop2 /initrd/${CFGIMG};mke2fs -q /dev/ram15)
    -Mounts them all (mount -r -t squashfs -o noatime /dev/loop1 /romimg; mount -r -t squashfs -o noatime /dev/loop2 /cfgimg; mount -nt ext2 /dev/ram15 /ramdsk)
    -Mounts the union (mount -t unionfs -o dirs=ramdsk=rw:cfgimg=ro:romimg=ro none ${rootmnt})

 OK, that seems to work, the system boots and I'm able to change any config by writing it in the top ramdsk.

 The problem comes when I want to make this changes permanent. I can regenerate the cfgimg (that basically  contains the /etc directory) but then I should remount my /initrd (rw) for overwriting cfgimg and here comes the fun... If I try to mount it (mount -t ext3 /dev/hda1 /initrd) I get the message "mount: /dev/hda1 already mounted or /initrd busy", If I try to umount it I get "umount: /dev/hda1: not mounted" that's correct, no trace of hda1 in mount, mtab, lsof... 

 Creating a new  directory and trying to mount hda1 on it returns the same msg, so...if the device is not mounted and the dir isn't busy what's going on?

 I've two theories, first: what I'm trying to do is stupid and impossible, second: I'm making a big and (also) stupid mistake during the process.

 Please, I _really_ need help :)

 Thanks in advance.
 


 



 




More information about the unionfs mailing list