general question on null device

General support questions
Post Reply
harishpathangay
Posts: 36
Joined: 2017/03/14 10:01:39

general question on null device

Post by harishpathangay » 2017/09/26 05:02:24

hi,
I need a null device in a different location. the default location is /dev/null.

Can I create additional null device in a specific folder.
/db2/null
this will be a null device which db2 users alone can use.
I do not want to use the default null device, since all users can use it.
is that possible to have multiple null devices like that? how do I configure that?

why I need such a requirement is a very complicated thing. I do not want to discuss that at least for now.

thanks,
harish pathangay

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: general question on null device

Post by hunter86_bg » 2017/09/26 05:59:38

I guess you can create a udev rule for this task.

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: general question on null device

Post by avij » 2017/09/26 06:56:12

Sure, mknod /db2/null c 1 3

Where I got that c 1 3 magic? See ls -l /dev/null

harishpathangay
Posts: 36
Joined: 2017/03/14 10:01:39

Re: general question on null device

Post by harishpathangay » 2017/09/26 07:41:34

I was able to create the device, but permissions is a issue.

crw-rw-rw-. 1 root root 1, 3 Sep 26 12:52 /dev/null

crw-r--r--. 1 root root 1, 3 Sep 26 13:05 db2null

how to get the file permissions to rw and ownership to db2user.

I am dba not a unix person. so I offer my apologies for my lack of knowledge.
google also did not help much.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: general question on null device

Post by hunter86_bg » 2017/09/26 08:31:23

Yeah, it seems mknod is way better approach.

When you create your /db2/null device you can set the file permission bits:
-m, --mode=MODE
set file permission bits to MODE, not a=rw - umask
Here is an example:

Code: Select all

#mknod -m 660 /tmp/null c 1 3
# ls -l /tmp/null
crw-rw----. 1 root root 1, 3 Sep 26 11:30 /tmp/null

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: general question on null device

Post by avij » 2017/09/26 09:14:04

mknod -m 666 /db2/null c 1 3 will create an entry with world-writable permissions. If you want to, you can change its owner with chown db2user /db2/null

harishpathangay
Posts: 36
Joined: 2017/03/14 10:01:39

Re: general question on null device

Post by harishpathangay » 2017/09/26 09:51:02

thanks to all. works fantastically.

except I was wrong in my thinking. I do not know if I am correct. please let me know.

I created this null device and it is working. how will I track the io happening on that null device?
iostat is not showing any information on the null device.
it shows only at LVM and disk partition level.

how will I track or make iostat or any other command to report saying this much bytes got written in this particular custom null device?

sorry for being such a botheration. this is my original requirement. iostat works at disk or partition or LVM level.
for a character device like null device how do I track that information.

thanks.

Post Reply