Using the Udev method in Linux 7

Source: Internet
Author: User
Tags dba uuid

Slowly Linux 7 users more and more, but the Linux 7 relative to 5 and 6 of the version, the change is indeed relatively large, this article describes how to achieve Udev in Linux 7, the implementation of equipment persistence, permissions and the changes to the group
Linux version
Oracle Linux Server Release 7.1
[Root@www.111cn.net ~]# Uname-a
Linux www.111cn.net 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 04:05:24 PST 2015 x86_64 x86_64 x86_64
The display of UUID in VMware workstation needs to be increased in VMX files
Disk.enableuuid = "TRUE"
viewing disk partitions
[Root@www.111cn.net ~]# Fdisk-l

disk/dev/sdb:21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * the bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk label Type:dos
Disk identifier:0xf60fe217

Device Boot Start End Blocks Id System
/DEV/SDB1 2048 2099199 1048576 Linux

disk/dev/sda:42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * the bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk label Type:dos
Disk identifier:0x000bce7c

Device Boot Start End Blocks Id System
/DEV/SDA1 2048 4204543 2101248 8e Linux LVM
/DEV/SDA2 * 4204544 79702015 37748736 Linux

disk/dev/sdc:32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * the bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes


disk/dev/mapper/ol-swap:2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * the bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
View Disk UUID
[Root@www.111cn.net ~]#/usr/lib/udev/scsi_id-g-U/DEV/SDB1
36000c29e91831cedbe69afe6cc08daf7
[Root@www.111cn.net ~]#/usr/lib/udev/scsi_id-g-U/DEV/SDC
36000c292495e9d9de6f21640cc7b53b9
Udev binding
[Root@www.111cn.net ~]# More/etc/udev/rules.d/99-my-asmdevices.rules
kernel== "sd*[!0-9]", env{devtype}== "Disk", subsystem== "block", program== "/usr/lib/udev/scsi_id-g-u-d $devnode",
result== "36000c292495e9d9de6f21640cc7b53b9", run+= "/bin/sh-c ' MKNOD/DEV/XIFENFEI-SDC b $major $minor;
Chown ORACLE:DBA/DEV/XIFENFEI-SDC; chmod 0660/DEV/XIFENFEI-SDC ' "

kernel== "Sd?1", subsystem== "block", program==/lib/udev/scsi_id-g-u-d/dev/$parent ",
result== "36000c29e91831cedbe69afe6cc08daf7", symlink+= "xifenfei-sdb1", owner= "Oracle", group= "DBA", MODE= "0660"
Binding results
[Root@www.111cn.net ~]# ls-l/dev/xifenfei-*
lrwxrwxrwx. 1 root 4 Aug 7 22:49/dev/xifenfei-sdb1-> SDB1
BRW-RW----. 1 Oracle DBA 8, Aug 7 22:36/DEV/XIFENFEI-SDC
[Root@www.111cn.net ~]# ls-l/DEV/SDB1
BRW-RW----. 1 Oracle DBA 8, Aug 7 22:49/DEV/SDB1
Udev only Modify Disk permissions
[Root@www.111cn.net ~]# Fdisk/dev/sdb
Welcome to Fdisk (Util-linux 2.23.2).

Changes'll remain in memory only, until you decide to write them.
Be careful before using the Write command.


Command (M for help): N
Partition Type:
P Primary (1 primary, 0 extended, 3 free)
E Extended
Select (default p): P
Partition number (2-4, default 2):
The sector (2099200-41943039, default 2099200):
Using Default Value 2099200
Last sector, +sectors or +size{k,m,g} (2099200-41943039, default 41943039): +1g
Partition 2 of type Linux and of size 1 GiB is set

Command (M for help): W
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks.
[Root@www.111cn.net ~]# More/etc/udev/rules.d/99-my-asmdevices.rules
kernel== "Sd?2", subsystem== "block", program==/lib/udev/scsi_id-g-u-d/dev/$parent ",
result== "36000c29e91831cedbe69afe6cc08daf7", owner= "Oracle", group= "DBA", mode= "0660"
[Root@www.111cn.net ~]#/sbin/udevadm Trigger--type=devices--action=change
[Root@www.111cn.net ~]# ls-l/DEV/SDB2
BRW-RW----. 1 Oracle DBA 8, Aug 7 23:14/DEV/SDB2
There are two ways to bind Udev in Linux 7, one for real generation of udev devices and the other for soft connections. Thank Lunar (lunar Oracle Lab) for help in Linux 7 learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.