unmount file system at shutdown in Android.

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

unmount file system at shutdown in Android.

4,698 Views
johnturnur
Contributor III

Hello,

In some specific application on IMX6Q SABRE SD, I need to unmount /data and /system partition of android at  shutdown time. I have called function umount("/data") and umount2("/data",MNT_FORCE) at very low level of  function android_reboot ( ) function which is called from ShutdownThread.java file.

function umount fails at this point.


can anyone suggest the place where i can call umount function to unmount the file system successfully ?


Also, is remount function first umount the media and then mount?


Thanks,

Labels (3)
0 Kudos
Reply
2 Replies

1,563 Views
YixingKong
Senior Contributor IV

John, please click Correct Answer/Helpful Answer if your questions had been resolved.

Thanks,

Yixing

0 Kudos
Reply

1,563 Views
JayTu
NXP Employee
NXP Employee

If there is process accessing the partition, it won't be allowed to umount/remount.

Take data partition for example, I can see zygote, setting, lock screen, ... are accessing it. There are no ways to let those processes release accessing now.

The simple way is just to kill zygote then other processes spawned by zygote will also got killed then release. (Since your use case is at shutdown)

So, you can try the command in your console:

root@android:/ # stop

root@android:/ # umount /data

root@android:/ # mount

...

/dev/block/mmcblk0p5 /system ext4 ro,relatime,user_xattr,barrier=1,data=ordered 0 0

/dev/block/mmcblk0p6 /cache ext4 rw,nosuid,nodev,relatime,user_xattr,barrier=1,nomblk_io_submit,data=ordered 0 0

/dev/block/mmcblk0p7 /device ext4 ro,nosuid,nodev,relatime,user_xattr,barrier=1,data=ordered 0 0


As above showed, umount or remount worked.