CentOS 6.2 iSCSI Initiator (Part 1)
First install iscsi-initiator-utils.x86_64
# yum -y install iscsi-initiator-utils.x86_64
Then perform a discovery
# iscsiadm -m discovery -t sendtargets -p datastor01.aossama.net
The output should look something like this
192.168.0.34:3260,1 iqn.2012-20.com.aossama:datastor01
Finally start iscsi and iscsid service.
# chkconfig iscsi on && chkconfig iscsid on
# service iscsi start && service iscsid start
Advanced tasks on iSCSI initiators in Part 2.
CentOS 6.2 iSCSI target (Part 1)
First Prepare a LUN (Logical Unit Number):
# dd if=/dev/zero of=/opt/lun0.img bs=1M seek=10240 count=0
This will allocate a thin provisioned LUN which will be used as for the iSCSI target device.
After that install scsi-target-utils.x86_64 package, enable the service and start it:
# yum -y install scsi-target-utils.x86_64
# chkconfig tgtd on
# service tgtd start
Then create a target device
# tgtadm --lld iscsi --mode target --op new --tid=1 \
--targetname iqn.2012-04.com.aossama:datastor01
Add the LUN to the target device
# tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /opt/lun0.img
Finally allow all initiators
# tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
Check that everything is configured correctly
# tgtadm --lld iscsi --op show --mode target
And that's it, simple!!!
But that's not all the story, performing more advanced tasks such as setting CHAP authentication on the target and setting digest are covered in Part 2.
Working with a journal-ized bind zone
Bind9 journal file is a file which is created by the server either when a dynamic update takes place on the journal-ized zone or by changes that result from incoming incremental zone transfers.
To view the zone's journal in a human-readable form:
named-journalprint /path/to/zone/journal/file.jnl
If you have a zone configured for dynamic updates, most probably you won't be able to deal with the zone file directly, first disable dynamic updates to the zone using rndc freeze zone. This will also remove the zone's .jnl file and update the master file. Edit the zone file. Run rndc unfreeze zone to reload the changed zone and re-enable dynamic updates.
Subversion on CentOS (Part 1)
Subversion isn't only for coders or developers, I have been using it for few years to track the changes on my configuration files, make a central repository for a group of servers. This quick how-to explains how to install and do basic configuration of subversion across Apache on a network.
The first thing to do is to install the required packages...
# yum install httpd mod_dav_svn subversion
Generally the package shipped with CentOS works with the default configuration so I am not going to go deep into apache's configuration, just make sure apache is running and it works with the system startup...
# service httpd start
# chkconfig httpd on
You could also check if svn module is loaded into apache or not (mine was loaded automatically after installing the package)
# apachectl -M | grep svn
Then we configure the repository (repo for short)
# mkdir /var/svn && cd /var/svn/
# svnadmin create project1
# chown -R apache.apache /var/svn/
The next step is to setup some settings within Apache so Subversion and Apache play nice together.
# vim /etc/httpd/conf.d/subversion.conf
The basic configuration of apache to serve an svn repo is like:
DAV svn
SVNParentPath /var/svn
After that, restart apache, and browse to your repo...
# service httpd restart
Go to http://my.server.hosting.svn/svn/project1
and you should get the version 0 page of your repo
To be continued...
Quick Note: Find partition size in GB from fdisk
I am a big fan of fdisk, and since the output of fdisk is the block size of each partition I had to find a way to know how much each partition's size in GB...
Do the regular fdisk command, and note the block size:
# fdisk -l /dev/sda
output omitted...
Device Boot Start End Blocks Id System
/dev/xvdc1 * 1 2871 23061276 83 Linux
...output omitted
Then using bc (An arbitrary precision calculator language) do:
# echo "23061276/(2^20)" | bc
21
Which will output the partition size in GB