You are on page 1of 24

Adjusting Storage Device Access

Andrew Mallett
@theurbanpenguin | www.theurbanpenguin.com
Objective 204.2
Adjusting Storage Device Access
Lab Setup
To demonstrate we will use CentOS 7. The
system is virtualized. This will be a fresh build of
CentOS with the root files system being on
/dev/sda.

We have an additional virtual drive /dev/sdb


which we can use to be shared via iSCSI.
What on Today’s Menu

• Partition numbering
• Configuring disks
• Configuring the iSCSI target/server
• Configuring the iSCSI client
Disk Numbering

/dev/sda or /dev/hda
Device major and minor numbers
Maximum 15 partitions
Use lsblk to display device
numbering
Demo: Disk Numbering
hdparm - sdparm

Tune Disk Performance : Both utilities are


used to tune disk performance
hdparm: ATA Devices: yum install hdparm
sdparm: SCSI Devices: yum install sdparm
hdparm -tT /dev/sda1
sdparm /dev/sda
sdparm --get=WCE /dev/sda
Demo: Disk Tuning with sdparm and
hdparm
vm.dirty_background_ratio: The % of
system memory that can be filled with
dirty pages before they are written to disk
by system background processes
vm.dirty_ratio: Absolute maximum
amount of system memory that can be
filled with dirty pages before process
itself writes to disk
# cat /proc/vmstat | grep nr_dirty
# sysctl -a | grep ‘vm.dirty’
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10

Decrease the Cache


Often your disk sub-systems will have their own disk cache so we do not need the risk
of storing dirty data in the OS
$ sudo yum install targetd targetcli
$ sudo systemctl enable targetd

Install iSCSI Target


The iSCSI Target is the server that shares disks or logical volumes on the network. You
can make your Linux server act as a SAN
# targetcli
/> ls
/> backstore/block/create my_san /dev/sdb
/> iscsi/ create iqn.2015-03.com.pluralsight:san1
/> ls

Creating iSCSI Backstores and Targets


Here we create a backstores and target
/> cd iscsi/iqn.2015-03.com.pluralsight:san1/tpg1/
/…/tpg1> luns/ create /backstores/block/my_san
/…/tpg1> acls/ create iqn.2015-03.com.pluralsight.client:san1
OR
/…/tpg1> set attribute demo_mode_write_protect=0
/…/tpg1> cd /
/> exit

Adding LUNS and ACLS


If you do not add the ACL then the LUN is read-only. We can disable this if we want
for demonstration. In this way any client can connect
Demo: Creating iSCSI Targets
$ sudo iscsiadm --mode discovery --type sendtargets \
--portal 192.168.40.3 --discover
$ sudo iscsiadm --mode node \
--targetname iqn.2015-03.com.pluralsight:san1 \
--portal 192.168.40.3 --login

iSCSI Initiator
The iSCSI initiator is the client
iSCSI Initiator

iscsiadm iscsid iscsid.conf


Demo: Connecting to iSCSI SANs
WWN or WWID
The WWN (World Wide Name) also known as the
WWID is a unique 8 or 16 byte number used to
identify storage devices similar to the Ethernet MAC
addresses.
LUN
The LUN or Logical Unit is the addressable part of
iSCSI, in simple terms the device or logical volumes
that is shared.
Storage Devices

Disk and partition numbering


Disk tuning with hdparm, sdparm and
sysctl
iSCSI targets/initiators
Next Up: Logical Volumes

You might also like