2

How can I rename /proc to something else forcefully?

mv /proc /0

gives

mv: cannot move ‘/proc’ to ‘/0’: Device or resource busy

5
  • 1
    proc is process information pseudo-filesystem. It is usually mounted on /proc and its read-only. Maybe you can mount it with read/write but i don't really see what is the point of what you are trying to do. Feb 19, 2016 at 12:53
  • I just want to rename any directory present under / especially proc which is pseudo filesysytem!! I mentioned proc coz i wanted to explore what happens if i rename proc
    – linunix
    Feb 19, 2016 at 13:00
  • 1
    Then your exploration is completed. If you rename /proc, you got an error message stating you can't do that (and shouldn't anyway). /proc is hardcoded in several commands so renaming it would break them.
    – jlliagre
    Feb 19, 2016 at 13:12
  • I don't think you are able to rename/unmount etc /proc while the OS is running. Feb 19, 2016 at 13:18
  • 6
    The whole idea of renaming /proc is simply going to break things. Quite a few user space utilities, like ps(1) for example, expect /proc to be /proc. What you're trying to do is like trying to take a sedan and replace its steering wheel with a football and its dashboard with a cup of coffee before asking why on earth do the readings look funny.
    – user48669
    Feb 19, 2016 at 16:10

1 Answer 1

3

You cannot rename a directory on which a filesystem is currently mounted.

(Why not? I expect it would mess up a lot of kernel data structures that keep track of mounted filesystems.)

Linux lets you change the directory that a filesystem is mounted on, however. You can do this:

mkdir /0
mount --move /proc /0

After this, the proc filesystem will be mounted on /0, and /proc won't be a mount point anymore.

Don't do this on a production system, of course. It won't completely break your system, however, it'll just make some programs work badly or not at all (for example, say goodbye to ps). Keep a root shell open, and run mount --move /0 /proc to get the proc filesystem back where applications look for it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .