Overwrite root filesystem

Sep 17, 2003 2 Replies

Hi all,



Does anyone know if it's possible to overwrite a mounted filesystem with another filesystem without having to umount or reboot?



I'm busy building a tool which allows us to remotely update all software (inc. kernel) on a single board computer at once. The SBC has a motorola



85000 cpu, 4-16mb flash and 4-16mb ram. The SBC has its root filesystem on the flash. The QSLinux flash drivers allow us to overwrite the filesystem by writing to /dev/flash0. We tested this and it works. The problem is we also need to access this new filesystem so we can save some configuration files before rebooting. Unfortunally I can't get that to work.

I've build a static daemon which kill's all other processes, remounts root read-only and receives the new filesystem image over the network. After overwriting the currect filesystem I use the ioctl BLKFLSBUF and BLKRRPART to flush all buffers and re-read the partition table. Remounting /dev/ftla read-write on / works and I can list the new filesystem. Accessing and creating files however results in corruption.



I think the problem is some kind of filesystem cache, maybe a cache in the VFS layer. Does anybody here knows what could be wrong or give me some pointers where to look?



thanks in advance, Wolter Kamphuis



Hi,

I have a similar problem to yours. The way I solve the problem is to load a tarball of the new filesystem off another storage device (could be RAM disk, could be CD-ROM) and decompress it over the old filesystem. I then run a post-processing shell script (which is inside the firmware upgrade tarball) that deletes any files that have been superseded by files with different names. IOW it is logically something like this:

cd / tar zxvf /mountpoint/upgrade.tar.gz ./post-process.sh

(post-process.sh was extracted from upgrade.tar.gz).

Hi,

My program will be used to update modems and routers > Hi,

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required