码迷,mamicode.com
首页 > 系统相关 > 详细

Redhat Linux 7 创建UDEV设备

时间:2018-07-19 16:17:49      阅读:396      评论:0      收藏:0      [点我收藏+]

标签:创建   管理   create   内容   lin   evm   name   介绍   add   

RHEL7下的udev管理与之前的版本有一定的区别,下面简单介绍了基于LVM的UDEV配置。
1、创建逻辑卷

[root@hdp06 ~]# pvcreate /dev/sdb
[root@hdp06 ~]# vgcreate datavg /dev/sdb
[root@hdp06 ~]# for id in catbs ustbs tmtbs;do lvcreate -n $id -L +512M datavg;done
[root@hdp06 ~]# lvcreate -n tbs01 -L +20G datavg
[root@hdp06 ~]# for id in stbs1 utbs1;do lvcreate -n $id -L +1G datavg;done
[root@hdp06 ~]# ll /dev/dm-{2..7}
brw-rw---- 1 root disk 249, 2 Jul 19 11:49 /dev/dm-2
brw-rw---- 1 root disk 249, 3 Jul 19 11:49 /dev/dm-3
brw-rw---- 1 root disk 249, 4 Jul 19 11:49 /dev/dm-4
brw-rw---- 1 root disk 249, 5 Jul 19 11:49 /dev/dm-5
brw-rw---- 1 root disk 249, 6 Jul 19 11:49 /dev/dm-6
brw-rw---- 1 root disk 249, 7 Jul 19 11:49 /dev/dm-7

2、获取UUID

[root@hdp06 ~]# for i in {2..7};do udevadm info --query=all --name=/dev/dm-$i | grep -i DM_UUID;done
E: DM_UUID=LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YfWXcy2QJ0N17L2HuAsEzTlfWBTMyXMjX
E: DM_UUID=LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YIVnlrSdMdMe6MrdpzT1oWR4oGVYjLgTP
E: DM_UUID=LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YA6DF2S7gHxiWwonFFnGskv8oqn09ehuJ
E: DM_UUID=LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YX43yw6FLWfDYGKQ4iCMQYoj5CCaWsO0z
E: DM_UUID=LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YV5Ft9f0ld7QjxASNgvkHFqoSWfgJqvsT
E: DM_UUID=LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YJwktSMWrevmXvzi4DwzYvswwtOuu1U9o

对应的udev规则文件内容如下:

[root@hdp06 ~]# cat /etc/udev/rules.d/99-db2disk-owner.rules 
ACTION=="add|change", ENV{DM_UUID}=="LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YfWXcy2QJ0N17L2HuAsEzTlfWBTMyXMjX", NAME="catbs",  OWNER="abcinst", GROUP="db2iadm", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YIVnlrSdMdMe6MrdpzT1oWR4oGVYjLgTP", NAME="ustbs",  OWNER="abcinst", GROUP="db2iadm", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YA6DF2S7gHxiWwonFFnGskv8oqn09ehuJ", NAME="tmtbs", OWNER="abcinst", GROUP="db2iadm", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YX43yw6FLWfDYGKQ4iCMQYoj5CCaWsO0z", NAME="tbs01", OWNER="abcinst", GROUP="db2iadm", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YV5Ft9f0ld7QjxASNgvkHFqoSWfgJqvsT", NAME="stbs1", OWNER="abcinst", GROUP="db2iadm", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="LVM-F5TLuj05MSbaG40MlW1YJnvwLdGrZd7YJwktSMWrevmXvzi4DwzYvswwtOuu1U9o", NAME="utbs1", OWNER="abcinst", GROUP="db2iadm", MODE="0660"

3、启动UDEV

[root@hdp06 ~]# /usr/sbin/udevadm trigger
[root@hdp06 ~]# ll /dev/dm-{2..7}
brw-rw---- 1 abcinst db2iadm 249, 2 Jul 19 14:46 /dev/dm-2
brw-rw---- 1 abcinst db2iadm 249, 3 Jul 19 14:46 /dev/dm-3
brw-rw---- 1 abcinst db2iadm 249, 4 Jul 19 14:46 /dev/dm-4
brw-rw---- 1 abcinst db2iadm 249, 5 Jul 19 14:46 /dev/dm-5
brw-rw---- 1 abcinst db2iadm 249, 6 Jul 19 14:46 /dev/dm-6
brw-rw---- 1 abcinst db2iadm 249, 7 Jul 19 14:46 /dev/dm-7

Redhat Linux 7 创建UDEV设备

标签:创建   管理   create   内容   lin   evm   name   介绍   add   

原文地址:http://blog.51cto.com/candon123/2147185

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!