After establishing a session, the LUNs are represented as block devices in the /dev directory.
In an Oracle VM Server for x86 environment, disk devices appear as virtual block devices (xvd).
After establishing a session, the iSCSI LUNs appear as SCSI (sd) devices:
# fdisk -l |grep /dev
Disk /dev/xvda: 42.4 GB, 42446356480 bytes, 82903040 sectors
/dev/xvda1 * 2048 1026047 512000 83 Linux
/dev/xvda2 1026048 40959999 19966976 83 Linux
Disk /dev/xvdb: 4294 MB, 4294967296 bytes, 8388608 sectors
Disk /dev/xvdd: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/xvde: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/xvdf: 10.7 GB, 10737418240 bytes, 20971520 sectors
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
You can view the /var/log/messages file for initialization messages:
# tail –f /var/log/messages
…
<date> host03 kernel: sd 2:0:0:1: [sda] Attached SCSI disk
…
<date> host03 kernel: sd 2:0:0:2: [sdb] Attached SCSI disk
…
You can now partition and create a file system on the LUNs by using utilities such as fdisk and mkfs:
# fdisk /dev/sda
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): ENTER
Using default response: p
Partition number (1-4, default 1): ENTER
First sector (8192-20971519, default 8192): ENTER
Using default value 8192
Last sector, +sectors or +size{K,M,G} (8192-20971519, default 20971519): +1G
Partition 1 of type Linux and of size 1 GiB is set
Command (m for help): w
…
# mkfs –t ext4 /dev/sda1
…
Make a mount point and mount the file system:
# mkdir /iscsi_dev
# mount /dev/sda1 –o _netdev /iscsi_dev
# df –h
Filesystem Size Used Avail Use% Mounted on
…
/dev/sda1 976M 2.6M 907M 1% /iscsi_dev
When creating entries for iSCSI LUNs in the /etc/fstab file, use the _netdev option. This indicates that the file system resides on a device that requires network access. This option is used to prevent the system from attempting to mount the file system until the network has been enabled:
# vi /etc/fstab
/dev/sda1 /iscsi_dev ext4 _netdev 0 0
You can view iSCSI initialization messages in the /var/log/messages file
Recent Comments