Comment 38 for bug 17878

Revision history for this message
wangrui (cnsdqdwangrui) wrote :

Hi, this problem had bothered me for a very long time one month ago. I used a flash disk to host the root partition to solve the problem. But after a month, I find the flash disk was easily lost data even with readonly all the time. So I moved back to hard disk. But the unionfs solution seems works well to solve this problem:

I'm using ubuntu AMD64, I found that /etc/mtab and /etc/hosts was access all the time. So if we mount etc into memory, the hard disk click will stopped immediately.

Put the following lines into the proper position of /etc/init.d/mountkernfs.sh:

/bin/mount -v -n --bind /etc /unionfs/ro/etc
/bin/mount -v -n -t unionfs -o dirs=/unionfs/mem/etc=rw:/unionfs/ro/etc=ro unionfs /etc

And you also need to put another script in rc0.d and rc6.d to save the changes in etc. And one in rcS.d to restore the changes. Otherwise all changes to etc will lost after a reboot.