kalyan keerthi wrote:
Hi,

I have created squashfs for our embedded board.
I excluded /mnt directory from being squashed.
I now have the rootfs "/" squashed (ro) and "/mnt" mounted on jffs2 (rw)
I tried to union these filesystems and make squashfs writeable, but it did not work below is the command that i used

# mount -t unionfs -o dirs=/mnt=rw:/=ro none /mnt

I can create and edit files in the /mnt directory. ex: cd /mnt/etc; cat > hello.c
but if i do the same in /etc directory it says readonly filesystem.
Can anyone please help me explain how to make rootfs "/" writeable

I appreciate your help

I maintain a project (MiniMyth) that does something similar. The root file system is a squashfs image and I use a RAM based file system to make it writable. Rather than put the root file system in /, I put it in a sub-directory (called /root-ro). I use an initial init script to do the following:

(1) Mount a read write partition in another sub-directory (called /rw).
(2) Use unionfs to unify them as another sub-directory (called /rw/rootfs).
(3) Use pivot_root and chroot to switch the root file system rot /rootfs and lauch the real init script

I have attached the initial init script below.

------------------------------------------------
#!/bin/sh

# Change the read-only root file system into a read-write root file system.
/bin/mount -n -t tmpfs none /rw
/bin/mkdir -p /rw/rootfs
/bin/mount -n -t unionfs -o dirs=/rw/rootfs=rw:/rootfs-ro=ro none /rootfs
cd /rootfs
/bin/mkdir -p initrd
/sbin/pivot_root . initrd

# Change root to the read-write root file system and start the real init.
exec /usr/sbin/chroot . ./bin/sh -c 'exec /sbin/init' <dev/console >dev/console 2>&1
_______________________________________________
unionfs mailing list: http://unionfs.filesystems.org/
unionfs@mail.fsl.cs.sunysb.edu
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to