I am trying to do a factory reset mechanism as a command. For that I am following these steps:

  1. Copy the default rootfs files to /tmp
  2. Kill all the currently running processes
  3. Mount tmp as root file system
  4. Copy the contents from tmpfs to previous rootfs partition
  5. 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.

  • it's very difficult to know what's stopping you without seeing what happens e.g. error messages. I can tell you that pivot_root has a man 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/… – sourcejedi Aug 17 '17 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.