LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Using /System instead of /sys ? (https://www.linuxquestions.org/questions/programming-9/using-system-instead-of-sys-522117/)

shevegen 01-23-2007 02:28 PM

Using /System instead of /sys ?
 
Hi,
I would like to use another dir name for /sys

But I dont know what exactly is needed to do this.

How does the kernel know that it must populate under /sys
and not under... say /Foobar dir?

rkelsen 01-23-2007 03:49 PM

Why do you want to do this?

syg00 01-23-2007 04:09 PM

Do it and find out. Can be mounted (anywhere) from userspace - including fstab.
Expect things to break.

Samoth 01-23-2007 04:45 PM

I know that Gobolinux does this with everything. The trick is to edit the line in your /etc/fstab and reflect it.
Code:

mount -t sysfs /System
Will work, I think.

shevegen 01-23-2007 10:11 PM

Yes, things break.
Symlinked ls doesnt work anymore ... kinda but it
was my mistake. Actually, no things seem to break
here for me when I mount sysfs somewhere else. ;)

The command:
mount -t sysfs /System

Does not work

This command:
mount -t sysfs none /System

Works but my ls is broken

EDIT: Ok found out... i had kept /System as a
special dir. I now tried it with /System2
and System2 got populated

Seems to work, die /sys die die die! :)






There is however a problem
I cannot create new dirs in /System
nor in /sys

mkdir: cannot create directory `foo': Operation not permitted

Anyone knows how to allow creation of dirs there?

EDIT2:
Ok I didnt bother to look at the reason, but it seems to be
NOT possible to create or touch etc.. do anything with a sysfs
mounted directory. I had a look at Gobolinux and indeed,
it had the same "problem" (its only a problem if you, as user,
want to create dirs in that mounted target).

On Gobolinux they do another indirection, they do:
--> sysfs is mounted on /System/Kernel/Objects

And thus get away with having an IMHO better directory
structure. The fact still remains that you cant create
anything there hmm. Which means that I cant easily create
a /System directory there, as I will not be able to
manipulate it at all.
So I probably will use an indirection similar to how
Gobolinux does it as well.

Well, I guess my question is somehow solved :)

gnashley 01-24-2007 03:52 PM

You can't mount anything there because sysfs is inside the kernel. You can change the path by patching the kernel, but then any program that uses info from /sys will be lost. You might be able to use unionfs to remount it somewhere else and get pseudo read-write that way.

syg00 01-24-2007 07:50 PM

What you are attempting to do now is not what you asked originally.
sysfs is a pseudo filesystem - a window into (some) kernel objects; a means of exposing data into userspace. Files within it will only be write-able from userspace if the (kernel/driver) code managing that file is smart enough to handle it - e.g. when you change sysctls by writing into /sys/whatever.
Put your data elsewhere.


All times are GMT -5. The time now is 07:23 AM.