LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   More Misc Linux Questions... (https://www.linuxquestions.org/questions/linux-newbie-8/more-misc-linux-questions-18555/)

ugenn 04-15-2002 09:10 AM

More Misc Linux Questions...
 
1. What would happen if I did a swapoff when other
processes are running? A Bad Thing?

2. What happens if I kill init (if possible)?

3. Are the settings in /etc/fstab visible only to the
mount command does the mount() system call
itself read this file?

4. How to check what kernel modules are active (
loadable types or otherwise)?

5. I can't access a device which I created w/ mknod.
for eg after I mknod myfile b 7 16 to create my
own loopback device file, I can't access it. Any
operations on myfile would give a 'not a valid device'
error message. I noticed that when I do an ls -l,
the owner is listed as my userid (root), but when
I ls -al the /dev dir, the owner is given as 'floppy'
or 'disk' etc. How do I fix this?

Thymox 04-16-2002 05:21 AM

1) I would hazard a guess that you could possibly get away with it if you have enough RAM and you aren't doing anything memory intensive.

4) I don't know what you mean by 'or otherwise', but to view what modules are being used, you type lsmod.

Mara 04-16-2002 06:18 AM

2 I guess it'll restart. But I'm not sure (haven't tried it).

Mik 04-16-2002 09:09 AM

1. If you have enough memory available then swapoff is save to do even if the swapfile is being used. If however it's swapping because there is not enough memory available then running swapoff could cause problems.

2. Init is the parent of most processes so it has to stay running. That's why it's also impossible to kill it. Not even with a SIGKILL.

3. The /etc/fstab file is just a text file. Usually the mount command will look in this file but it isn't necessary. The mount command keeps record of the mounted filesystems in the /etc/mtab file. This is also just a text file so you can just view the contents.

4. Like Thymox said lsmod lists the loaded modules. If you want to see which modules are available. Just run the following command to go to the kernels module directory and browse around:

cd /lib/modules/`uname -r`

5. Just making a device file is usually not enough. You have to either enable the support for it in the kernel or load the appropriate module.
If you want to change the owner/group of a file then run the command:

chown username.groupname filename

ugenn 04-16-2002 09:38 AM

Quote:

Originally posted by Mik

3. The /etc/fstab file is just a text file. Usually the mount command will look in this file but it isn't necessary. The mount command keeps record of the mounted filesystems in the /etc/mtab file. This is also just a text file so you can just view the contents.

Well, that didn't really answer the question. What I meant was, if I had a C program (say foo) which contains
the syscall mount(). Does the implementation of mount()
access the etc/fstab file or is that file merely read by /bin/mount executable.

4. Like Thymox said lsmod lists the loaded modules. If you want to see which modules are available. Just run the following command to go to the kernels module directory and browse around:

cd /lib/modules/`uname -r`

lsmod lists only loadable modules. What if I wanted to know what compiled-in drivers are also available? (looking at source is not an accepted answer ;)

5. Just making a device file is usually not enough. You have to either enable the support for it in the kernel or load the appropriate module.
If you want to change the owner/group of a file then run the command:

The support does exist. I was trying to create another device file for the loopback driver (major ver 7) which
was already compiled into the kernel by default.

chown username.groupname filename [/B]


All times are GMT -5. The time now is 06:13 PM.