使用udev管理asmdisk常用的命令
[root@udev bin]# pwd
/usr/bin
[root@udev bin]# ls udev*
udevinfo udevtest
[root@udev sbin]# pwd
/sbin
[root@udev sbin]# ls *udev*
start_udev udevcontrol udevd udevd.static udevsettle udevtrigger
[root@udev sbin]#
--==================================
1.在vmware下增加一塊disk
2.啟動linux
3.fdisk -l 顯示新加入的disk:
[root@udev ~]# fdisk -l /dev/sdf
Disk /dev/sdf: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdf doesn't contain a valid partition table
[root@udev ~]#
4.對新加入的disk分割槽:
[root@udev ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdf: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): +100m
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@udev ~]#
5.使用udevinfo顯示分割槽資訊:
[root@udev ~]# udevinfo -a -p /sys/block/sdf/sdf1
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/block/sdf/sdf1':
KERNEL=="sdf1"
SUBSYSTEM=="block"
SYSFS{dev}=="8:81"
SYSFS{partition}=="1"
SYSFS{start}=="63"
SYSFS{size}=="208782"
SYSFS{ro}=="0"
SYSFS{alignment_offset}=="0"
SYSFS{discard_alignment}=="0"
SYSFS{stat}==" 24 518 1084 4 0 0 0 0 0 3 4"
SYSFS{inflight}==" 0 0"
looking at parent device '/block/sdf':
ID=="sdf"
BUS=="block"
DRIVER==""
SYSFS{dev}=="8:80"
SYSFS{range}=="16"
SYSFS{ext_range}=="256"
SYSFS{removable}=="0"
SYSFS{ro}=="0"
SYSFS{size}=="16777216"
SYSFS{alignment_offset}=="0"
SYSFS{discard_alignment}=="0"
SYSFS{capability}=="50"
SYSFS{stat}==" 122 1286 4760 28 1 0 8 59 0 85 87"
SYSFS{inflight}==" 0 0"
SYSFS{events}==""
SYSFS{events_async}==""
SYSFS{events_poll_msecs}=="-1"
looking at parent device '/devices/pci0000:00/0000:00:10.0/host0/target0:0:5/0:0:5:0':
ID=="0:0:5:0"
BUS=="scsi"
DRIVER=="sd"
SYSFS{device_blocked}=="0"
SYSFS{type}=="0"
SYSFS{scsi_level}=="3"
SYSFS{vendor}=="VMware, "
SYSFS{model}=="VMware Virtual S"
SYSFS{rev}=="1.0 "
SYSFS{state}=="running"
SYSFS{timeout}=="60"
SYSFS{iocounterbits}=="32"
SYSFS{iorequest_cnt}=="0xa4"
SYSFS{iodone_cnt}=="0xa4"
SYSFS{ioerr_cnt}=="0xa"
SYSFS{modalias}=="scsi:t-0x00"
SYSFS{evt_media_change}=="0"
SYSFS{dh_state}=="detached"
SYSFS{queue_depth}=="32"
SYSFS{queue_ramp_up_period}=="120000"
SYSFS{queue_type}=="simple"
looking at parent device '/devices/pci0000:00/0000:00:10.0/host0/target0:0:5':
ID=="target0:0:5"
BUS=="scsi"
DRIVER==""
SYSFS{uevent}=="DEVTYPE=scsi_target"
looking at parent device '/devices/pci0000:00/0000:00:10.0/host0':
ID=="host0"
BUS=="scsi"
DRIVER==""
SYSFS{uevent}=="DEVTYPE=scsi_host"
looking at parent device '/devices/pci0000:00/0000:00:10.0':
ID=="0000:00:10.0"
BUS=="pci"
DRIVER=="mptspi"
SYSFS{vendor}=="0x1000"
SYSFS{device}=="0x0030"
SYSFS{subsystem_vendor}=="0x15ad"
SYSFS{subsystem_device}=="0x1976"
SYSFS{class}=="0x010000"
SYSFS{irq}=="17"
SYSFS{local_cpus}=="3"
SYSFS{local_cpulist}=="0-1"
SYSFS{modalias}=="pci:v00001000d00000030sv000015ADsd00001976bc01sc00i00"
SYSFS{numa_node}=="-1"
SYSFS{dma_mask_bits}=="64"
SYSFS{consistent_dma_mask_bits}=="64"
SYSFS{enable}=="1"
SYSFS{broken_parity_status}=="0"
SYSFS{msi_bus}==""
SYSFS{msi_irqs}==""
looking at parent device '/devices/pci0000:00':
ID=="pci0000:00"
BUS==""
DRIVER==""
SYSFS{uevent}==""
[root@udev ~]#
6.編輯udev的rule檔案,增加下面一行到/etc/udev/rules.d/99-oracle-asmdevices.rules裡面:
KERNEL=="sdf1", SUBSYSTEM=="block", SYSFS{size}=="208782", SYSFS{start}=="63", NAME="asmdisk4-data1", OWNER="grid", GROUP="asmadmin", MODE="0660"
7.增加上面一行之後/etc/udev/rules.d/99-oracle-asmdevices.rules的內容如下:
[root@udev rules.d]# more 99-oracle-asmdevices.rules
KERNEL=="sdc1", SUBSYSTEM=="block", SYSFS{size}=="16771797", SYSFS{start}=="63", NAME="asmdisk1-crs",
OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdd1", SUBSYSTEM=="block", SYSFS{size}=="16771797", SYSFS{start}=="63", NAME="asmdisk2-data"
, OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sde1", SUBSYSTEM=="block", SYSFS{size}=="16771797", SYSFS{start}=="63", NAME="asmdisk3-fra",
OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdf1", SUBSYSTEM=="block", SYSFS{size}=="208782", SYSFS{start}=="63", NAME="asmdisk4-data1",
OWNER="grid", GROUP="asmadmin", MODE="0660"
[root@udev rules.d]#
8.編輯rule檔案之後可以使用udevtest測試udev對裝置的管理,命名,連結以及許可權的設定情況
udevtest /block/sdf
9.重新啟動udev,在啟動之前首先使用命令udevcontrol重新裝載rules:
[root@udev rules.d]# udevcontrol reload_rules
[root@udev rules.d]#
[root@udev rules.d]#
10.重啟udev:
[root@udev rules.d]# cd /dev
[root@udev dev]# ls -l asm*
brw-rw---- 1 grid asmadmin 8, 33 May 30 14:28 asmdisk1-crs
brw-rw---- 1 grid asmadmin 8, 49 May 30 14:28 asmdisk2-data
brw-rw---- 1 grid asmadmin 8, 65 May 30 14:28 asmdisk3-fra
[root@udev dev]# start_udev
Starting udev: [ OK ]
[root@udev dev]# ls -l asm*
brw-rw---- 1 grid asmadmin 8, 33 May 30 14:29 asmdisk1-crs
brw-rw---- 1 grid asmadmin 8, 49 May 30 14:29 asmdisk2-data
brw-rw---- 1 grid asmadmin 8, 65 May 30 14:29 asmdisk3-fra
brw-rw---- 1 grid asmadmin 8, 81 May 30 14:29 asmdisk4-data1
[root@udev dev]#
很顯然,裝載rule之後重啟udev以後asmdisk4-data1出現了,接下來正常建立asm diskgroup使用asmdisk4-data1就可以了.
11.udev是否啟動了我們直接在os上查詢和udev相關的程式就可以了:
ps -ef|grep udev
12.有關udev的排錯我們可以使用udevmonitor,不過udevmonitor我沒有做更深入的研究,大家感興趣可以研究.
[root@udev ~]# which udevmonitor
/usr/sbin/udevmonitor
[root@udev ~]# cd /usr/sbin
[root@udev sbin]# ls *udev*
udevmonitor
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21374452/viewspace-2129494/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用UDEV管理配置ASMDISKdevASM
- 使用udev管理asmdisk執行/sbin/scsi_id不顯示UUIDdevASMUI
- 使用udev管理asmdisk執行/sbin/scsi_id不顯示UUID的解決方法devASMUI
- Kafka的常用管理命令Kafka
- 常用的 Docker 容器管理命令Docker
- RAC常用管理命令
- RAC 常用管理命令
- crs常用管理命令
- 常用的DB2管理命令DB2
- Linux命令整理,使用者管理,使用者組管理,系統管理,目錄管理常用命令Linux
- linux使用者管理常用命令Linux
- 使用udev(轉)dev
- 使用udev高效、動態的管理Linux裝置檔案devLinux
- Linux常用命令速查-使用者管理Linux
- 【工具使用】常用的SQLMAP命令SQL
- 常用的使用者以及檔案管理命令有哪些,並演示命令以及用法。
- centos常用網路管理命令CentOS
- oracle 管理常用命令Oracle
- UDEV管理RAC共享儲存dev
- Linux使用者和組管理常用命令Linux
- Linux磁碟管理常用的三個命令!Linux
- docker常用命令的使用Docker
- 使用wireshark常用的過濾命令
- 常用的shell命令和使用技巧
- 【CDB】Oracle CDB/PDB常用管理命令Oracle
- MySQL DBA 管理常用命令MySql
- AIX 卷管理常用命令AI
- Linux常用系統管理命令Linux
- MySQL 5.5 常用的複製環境管理命令MySql
- AIX 管理交換分割槽經常用到的命令AI
- 使用 udev 高效、動態地管理 Linux 裝置檔案devLinux
- Linux上使用IPMITool常用的命令LinuxMIT
- Linux常用命令--許可權管理命令Linux
- linux下udev和mdev的使用Linuxdev
- 十 叢集管理常用命令
- firewalld管理防火牆常用命令防火牆
- ssh使用(常用命令)
- Maven使用常用命令Maven