How can I mount root file system on RAM?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I mount root file system on RAM?

1,360 Views
wangvictor
Contributor III

Hi All,

I'm using Yocto project to build my image and installed Ubuntu 16.04 LXDE as my root file system.

I'm trying to protect my eMMC get panic when the power is unexpectedly off.

Thereby, I found a overlayroot package that can do what I need.

After some googling, I realized that overlayroot is trying to let original root filesystem mount on /media/root-ro as type read-only file.

And it will mount it to /media/root-rw as type tmpfs.

Then mount overlayroot on / as type overlay

Below is content of mount.

/dev/sda1 on /media/root-ro type ext4 (ro) 
tmpfs-root on /media/root-rw type tmpfs (rw,relatime) 
/dev/sda2 on /data type ext4 (rw)

All of this were based on X86 platform with Ubuntu 16.04 OS system and it worked perfectly.

However While I try exactly same way on i.MX6DL sabreSD, it couldn't work right.

These are what I had done step by step.

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install overlayroot
  4. sudo apt-get install ubuntu-server
  5. vim /etc/overlayroot.conf

    overlayroot="tmpfs:swap=1,recurse=0"

  6. reboot

After I did all these steps I still cannot success to execute overlayroot.

 

In conclusion, I need help on several questions.

  1. Is anyone get anyway to protect eMMC from power unexpect off?
  2. Is anyone can help me on overlayroot package?
  3. Did anyone got similar way to reached the same work as overlayroot?

 

Thanks in Advanced!

0 Kudos
1 Reply

952 Views
b36401
NXP Employee
NXP Employee

We have no experience with overlayroot. Sorry for the inconvenience.
However we can offer you following way to make rootfs unchanged.
You can move all significant parts of rootfs like /etc/ into RAM this way:
mkdir /media/etc
mount tmpfs -t tmpfs /media/etc
cp -a /etc/* /media/etc
mount -o bind /media/etc /etc

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos