unmount file system at shutdown in Android.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

unmount file system at shutdown in Android.

5,388 次查看
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,

标签 (3)
0 项奖励
回复
2 回复数

2,253 次查看
YixingKong
Senior Contributor IV

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

Thanks,

Yixing

0 项奖励
回复

2,253 次查看
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.