We're trying to use oprofileto track down performance problems on a server cluster. However, the servers in question have a read-only file system, where /var/tmp is the only writeable directory.


OProfile wants to create two directories whenever it runs: `/root/.oprofile` and `/var/lib/oprofile`, but it can't, because the filesystem is read-only. I can use the `--session-dir` command line option to make it write its logs to elsewhere than `/var/lib`, but I can't find any such option to make it use some other directory than `/root/.oprofile`.


The filesystem is read-only because it is on nonwriteable media, not because of permissions -- ie, not even superuser can write to those directories. We can cook a new ROM image of the filesystem (which is how we installed oprofile, obviously), but there is no way for a runtime program to write to /root, whether it is superuser or not.


I tried creating a symlink in the ROM that points /root/.oprofile -> /var/tmp/oprofile, but apparently oprofile doesn't see this symlink as a directory, and fails when run:


    redacted@redacted:~$ sudo opcontrol --no-vmlinux --start --session-dir=/var/tmp/oprofile/foo

    mkdir: cannot create directory `/root/.oprofile': File exists

    Couldn't mkdir -p /root/.oprofile


We *must* run our profilers on this particular system, because the performance issues we're trying to investigate don't manifest if we build and run the app on a development server. We can't just run our tests on a programmer's workstation and profile the app there, because the problem doesn't happen there.


Is there some way to configure oprofile so that it doesn't use `/root` ?