Rh436-configure the iscsi shared disk name and permissions through udev (rhel5.5)

Source: Internet
Author: User
Configure the iscsi shared disk name through udev: [root @ localhost ~] # Udevinfo-qpath-n/dev/sdb/block/sdb [root @ localhost ~] #/Sbin/scsi_id-g-s/block/sdb1IET00020001 [root @ localhost ~] # Vim/etc/ud

Configure the iscsi shared disk name through udev:

[Root @ localhost ~] # Udevinfo-q path-n/dev/sdb
/Block/sdb
[Root @ localhost ~] #/Sbin/scsi_id-g-s/block/sdb
1IET 00020001
[Root @ localhost ~] # Vim/etc/udev/rules. d/99-iscsi.rules
KERNEL = "sd *", PROGRAM = "/sbin/scsi_id-g-s % p", RESULT = "1IET 00020001", NAME = "sharedisk % n"
[Root @ localhost ~] # Vim/etc/udev/rules. d/99-myiscsi.rules
[Root @ localhost ~] # Service iscsi restart
Logging out of session [sid: 1, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]
Logout of [sid: 1, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]: successful
Stopping iSCSI daemon:
Iscsid dead but pid file exists [OK]
Starting iSCSI daemon: [OK]
[OK]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2012-05.com. example: ex333server. demo, portal: 192.168.221.254, 3260]
Logging in to [iface: default, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]
Login to [iface: default, target: iqn.2012-05.com. example: ex333server. demo, portal: 192.168.221.254, 3260]: successful
Login to [iface: default, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]: successful
[OK]
[Root @ localhost ~] # Fdisk-l

Disk/dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System
/Dev/sda1*1 25 200781 83 Linux
/Dev/sda2 26 1330 10482412 + 83 Linux
/Dev/sda3 1331 1591 2096482 + 82 Linux swap/Solaris

Disk/dev/sdb: 4 MB, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8*512 = 4096 bytes

Disk/dev/sdb doesn' t contain a valid partition table
[Root @ localhost ~] # Fdisk-l/dev/sharedisk

Disk/dev/sharedisk: 4 Mbit/s, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8*512 = 4096 bytes

Disk/dev/sharedisk doesn't contain a valid partition table
[Root @ localhost ~] #


Fdisk-l lists the default system disk names. to list the given disk terms, you must write them all (fdisk-l/dev/sharedisk ).


Configure the iscsi shared disk permissions:

[Root @ localhost rules. d] # cat/etc/passwd | grep nobody
Nobody: x: 99: 99: Nobody: // sbin/nologin
[Root @ localhost rules. d] # vim 99-myiscsi.rules
KERNEL = "sd *", PROGRAM = "/sbin/scsi_id-g-s % p", RESULT = "1IET 00020001", SYMLINK + = "sharedisk % n ", OWNER = "nobody", GROUP = "nobody", MODE = "0660"
[Root @ localhost rules. d] # service iscsi restart
Logging out of session [sid: 1, target: iqn.2012-05.com. example: ex333server. demo, portal: 192.168.221.254, 3260]
Logging out of session [sid: 2, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]
Logout of [sid: 1, target: iqn.2012-05.com. example: ex333server. demo, portal: 192.168.221.254, 3260]: successful
Logout of [sid: 2, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]: successful
Stopping iSCSI daemon:
Iscsid dead but pid file exists [OK]
Starting iSCSI daemon: [OK]
[OK]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2012-05.com. example: ex333server. demo, portal: 192.168.221.254, 3260]
Logging in to [iface: default, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]
Login to [iface: default, target: iqn.2012-05.com. example: ex333server. demo, portal: 192.168.221.254, 3260]: successful
Login to [iface: default, target: iqn.2012-05.com. example: ex333server.tar get244, portal: 192.168.221.254, 3260]: successful
[OK]
[Root @ localhost rules. d] # fdisk-l

Disk/dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System
/Dev/sda1*1 25 200781 83 Linux
/Dev/sda2 26 1330 10482412 + 83 Linux
/Dev/sda3 1331 1591 2096482 + 82 Linux swap/Solaris

Disk/dev/sdb: 4 MB, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8*512 = 4096 bytes

Disk/dev/sdb doesn' t contain a valid partition table

Disk/dev/sdc: 4 MB, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8*512 = 4096 bytes

Disk/dev/sdc doesn' t contain a valid partition table
[Root @ localhost rules. d] # fdisk-l/dev/sharedisk

Disk/dev/sharedisk: 4 Mbit/s, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8*512 = 4096 bytes

Disk/dev/sharedisk doesn't contain a valid partition table
[Root @ localhost rules. d] # ll/dev/sh
Sharedisk shm/
[Root @ localhost rules. d] # ll/dev/sharedisk
Lrwxrwxrwx 1 root 3 May 27/dev/sharedisk-> sdc
[Root @ localhost rules. d] # ll/dev/sd *
Brw-r ----- 1 root disk 8, 0 May 26 21:26/dev/sda
Brw-r ----- 1 root disk 8, 1 May 26 21:26/dev/sda1
Brw-r ----- 1 root disk 8, 2 May 26 21:26/dev/sda2
Brw-r ----- 1 root disk 8, 3 May 26 21:26/dev/sda3
Brw-r ----- 1 root disk 8, 16 May 27/dev/sdb
Brw-rw ---- 1 nobody 8, 32 May 27/dev/sdc
[Root @ localhost rules. d] #

The permissions for connecting to sharedisk have not changed, but the sdc permissions it directs to have become what we need.

Note: Do not confuse the double equals and single equals signs. All values equal to the following values must be enclosed in double quotation marks,
At the beginning, I didn't use double quotation marks when writing the MODE option (MODE = 0660). The result permission is always-rw-r -----,
It is inherited from umask (0022), but the permission to restart the iscsi service by umask is not followed by umask,
Change it to a pair with quotation marks (MODE = "0660"). Then, restart the iscsi service and the permission is normal.

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.