I am trying to do a factory reset mechanism as a command. For that I am following these steps:
- Copy the default rootfs files to /tmp
- Kill all the currently running processes
- Mount tmp as root file system
- Copy the contents from tmpfs to previous rootfs partition
- reboot
Now, the problem is I am unable to mount the tmpfs as rootfs.
I tried using switch_root
and pivot_root
with no success.
pivot_root
has aman
page, and other people have used it successfully for quite similar use cases, so I think there should be a way to do what you want unix.stackexchange.com/questions/306406/…