Installing Proftpd on Red-Hat EL 5 or 6

Installing proftpd on Red-Hat EL 5 or 6

Proftpd is one of the best an most wildly used ftp server on unix-like platforms.
You can find proftpd already packaged for many distributions.

Packaged software are easy to install and time saving but if you want the latest version and/or a custom install with specific options you will have to go through source compiling.

First download the latest version:

# wget "ftp://ftp.solnet.ch/mirror/proftpd.org/distrib/source/proftpd-1.3.4a.tar.bz2"
Download the md5 file to check the file data integrity:
# cat proftpd-1.3.4a.tar.bz2.md5
4e3235dc1ef95d36e59721d70c5c489c proftpd-1.3.4a.tar.bz2
# md5sum proftpd-1.3.4a.tar.bz2
4e3235dc1ef95d36e59721d70c5c489c proftpd-1.3.4a.tar.bz2

Unzip and mv the sources on /usr/local/src/ :

# bunzip2 proftpd-1.3.4a.tar.bz2
# tar xvf proftpd-1.3.4a.tar.gz
# mv proftpd-1.3.4a /usr/local/src/

Check if you have gcc rpm :

# rpm -qa|grep gcc
gcc-4.4.5-6.el6.x86_64

You may need to install other packages depending on what you already installed and the the proftpd options you will choose.

# cd /usr/src/local/proftpd-1.3.4a/

Read the install documentation:

# more INSTALL

Run the configuration.
I use –prefix= force proftd to install on /usr/local/proftpd and –enable-autoshadow to be able to use standard and shadow passwords.

# ./configure --prefix=/usr/local/proftpd --enable-autoshadow
# echo $?
0

Build proftpd :

# make
echo \#define BUILD_STAMP \"`date +"%a %b %e %Y %H:%M:%S %Z"`\" > include/buildstamp.h
cd lib/ && make lib
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib'
gcc -DHAVE_CONFIG_H -DLINUX -I.. -I../include -O2 -Wall -c pr_fnmatch.c
gcc -DHAVE_CONFIG_H -DLINUX -I.. -I../include -O2 -Wall -c sstrncpy.c
...
...
gcc -DHAVE_CONFIG_H -DLINUX -I.. -I../include -O2 -Wall -c ftpwho.c
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/utils'
gcc -L./lib -o ftpcount utils/ftpcount.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftpdctl src/ftpdctl.o src/pool.o src/str.o src/netaddr.o src/log.o src/ctrls.o -lsupp -lcrypt -ldl -L./lib/libcap -lcap
gcc -L./lib -o ftpscrub utils/ftpscrub.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftpshut utils/ftpshut.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftptop utils/ftptop.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
gcc -L./lib -o ftpwho utils/ftpwho.o utils/scoreboard.o utils/misc.o -lsupp -lcrypt -ldl
[root@frsu0069 proftpd-1.3.4a]# echo $?
0

Install it:

# make install
cd lib/ && make lib
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib'
make[1]: Nothing to be done for `lib'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/lib'
cd src/ && make src
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/src'
make[1]: Nothing to be done for `src'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/src'
cd modules/ && make static
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/modules'
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/modules'
test -z """" -a -z """" || (cd modules/ && make shared)
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib/libcap'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/lib/libcap'
...
...
cd lib/ && make install
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/lib'
make[1]: Nothing to be done for `install'.
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/lib'
/usr/bin/install -c -o root -g root -m 0644 config.h /usr/local/proftpd/include/proftpd/config.h
cd include/ && make install
make[1]: Entering directory `/usr/src/proftpd-1.3.4a/include'
make[1]: Leaving directory `/usr/src/proftpd-1.3.4a/include'
/usr/bin/install -c -o root -g root -m 0644 proftpd.pc /usr/local/proftpd/lib/pkgconfig/proftpd.pc
test -z """" || (cd locale/ && make install)
[root@frsu0069 proftpd-1.3.4a]# echo $?
0

Proftpd is now installed :

# ls /usr/local/proftpd
bin etc include lib libexec sbin share var

Copy the man pages in the appropriate directories (so you can use them) :

# cd /usr/local/proftpd/share/man/man1
# cp * /usr/share/man/man1/
# cd ../man5
# cp * /usr/share/man/man5/
# cd ../man8
# cp * /usr/share/man/man8/

Test proftpd with the embedded test procedure:

# sh /usr/local/src/proftpd-1.3.4a/sample-configurations/PFTEST.install
Sample test files successfully installed in /tmp/PFTEST.

The script purpose is to create a sample configuration file “PFTEST.conf” in /tmp/PFTEST
Run proftpd :

# /usr/local/proftpd/sbin/proftpd -n -d 5 -c /tmp/PFTEST/PFTEST.conf

(-n for “don’t start as daemon” and -d 5 for debug level “medium”)
Now connect with an ftp client to port 2012 with login proftpd and password proftpd :
on the server you will something like :

# /usr/local/proftpd/sbin/proftpd -n -d 5 -c /tmp/PFTEST/PFTEST.conf
FRSU0001 proftpd[18003]: using TCP receive buffer size of 87380 bytes
FRSU0001 proftpd[18003]: using TCP send buffer size of 16384 bytes
FRSU0001 proftpd[18003]: : using 'mod_ident.c' section at line 32
FRSU0001 proftpd[18003]: : adding section for resolved path '/'
FRSU0001 proftpd[18003] 192.168.0.111:
FRSU0001 proftpd[18003] 192.168.0.111: Config for ProFTPD TEST Installation:
FRSU0001 proftpd[18003] 192.168.0.111: /
FRSU0001 proftpd[18003] 192.168.0.111: AllowOverwrite
FRSU0001 proftpd[18003] 192.168.0.111: TransferLog
FRSU0001 proftpd[18003] 192.168.0.111: RequireValidShell
FRSU0001 proftpd[18003] 192.168.0.111: UseFtpUsers
FRSU0001 proftpd[18003] 192.168.0.111: WtmpLog
FRSU0001 proftpd[18003] 192.168.0.111: Umask
FRSU0001 proftpd[18003] 192.168.0.111: DefaultServer
FRSU0001 proftpd[18003] 192.168.0.111: UserID
FRSU0001 proftpd[18003] 192.168.0.111: UserName
FRSU0001 proftpd[18003] 192.168.0.111: GroupID
FRSU0001 proftpd[18003] 192.168.0.111: GroupName
FRSU0001 proftpd[18003] 192.168.0.111: AuthUserFile
FRSU0001 proftpd[18003] 192.168.0.111: AuthGroupFile
FRSU0001 proftpd[18003] 192.168.0.111: PidFile
FRSU0001 proftpd[18003] 192.168.0.111: TransferLog
FRSU0001 proftpd[18003] 192.168.0.111: RequireValidShell
FRSU0001 proftpd[18003] 192.168.0.111: UseFtpUsers
FRSU0001 proftpd[18003] 192.168.0.111: WtmpLog
FRSU0001 proftpd[18003] 192.168.0.111: IdentLookups
FRSU0001 proftpd[18003] 192.168.0.111: Umask
FRSU0001 proftpd[18003] 192.168.0.111: ProFTPD 1.3.4a (maint) (built Thu Mar 8 2012 14:02:45 CET) standalone mode STARTUP
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): session requested from client in unknown class
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): connected - local : ::ffff:192.168.0.111:2021
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): connected - remote : 192.168.0.20:3392
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): FTP session opened.
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_delay
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'USER proftpd' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching CMD command 'USER proftpd' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching POST_CMD command 'USER proftpd' to mod_delay
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching LOG_CMD command 'USER proftpd' to mod_log
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_core
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_delay
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching PRE_CMD command 'PASS (hidden)' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): dispatching CMD command 'PASS (hidden)' to mod_auth
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): user 'proftpd' authenticated by mod_auth_file.c
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]):
FRSU0001 proftpd[18006] 192.168.0.111 (192.168.0.20[192.168.0.20]): Config for ProFTPD TEST Installation:
…

Proftpd is working!
Now you just have to configure and secure Proftpd …

How to use iperf for network speed testing – Comment utiliser iperf pour des effectuer des tests de vitesse réseau.

Comment utiliser iperf pour des effectuer des tests réseau

While solving lots of backup issues in my job, I noticed that large number of those was directly related to network issues. Consequently it became a habit to test the network performances of the servers I manage.

Dans mon travail j’ai du résoudre de nombreux problèmes de sauvegarde et j’ai remarqué qu’un grand nombre d’entre eux sont directement liés à des soucis réseau. J’ai donc pris comme habitude de tester les performances réseau des serveurs que j’administre.

Why run network performance tests on your servers:

–          Detect network issue on your servers (wrong Ethernet port configuration, wrong switch configuration …).

–          Detect a global LAN issue (congestion, latency …).

Pourquoi tester les performances réseau de vos serveurs :

–          Pour détecter des problèmes réseau relatifs au serveur directement (configuration du port Ethernet ou du switch …).

–          Pour détecter des problèmes globaux LAN (congestion, latence …).

Why use iperf :

–          Very quick to use: 2 commands and the test is done.

–          Flexible: many options (see below).

–          Iperf exist on both Unix/Linux and Windows platforms.

–          Accurate: iperf doesn’t generate I/O or high CPU load that will distort your test results.

Pourquoi utiliser iperf :

–          Rapide à utiliser : 2 commandes et le test est fait.

–          Flexible : beaucoup d’options.

–          Iperf existe sur plusieurs plateformes.

–          Précis : iperf ne génère pas d’I/O ou charge CPU qui fausseront les résultats des tests.

Handy options:

Options utilies :

-p <port_number> : to change the default port (5001), useful if you are behind a firewall.

-t <seconds> : duration of the test (default is 10s).

-r : run a bidirectional test (up then down).

-d :  run simultaneously a bidirectional test  (up and down at the same time).

You can even launch iperf as a daemon (-D option) on a server so the iperf server will be ready whenever you want to test a client.

 

Options utiles :

-p <port_number> : pour changer le port par défaut (5001), utile si vous êtes derrière un firwall.

-t <seconds> : durée du test (10s par défaut).

-r : lance un test bidirectionnel (montant ensuite descendant).

-d : lance simultanément un test bidirectionnel  (en même temps montant et descendant).

Vous pouvez même lancer iperf en tant que daemon (option –D) sur un serveur. De cette façon le serveur iperf sera prêt à tester des clients à tout moment.

 

Using iperf :

Utiliser iperf :

On one of the servers launch iperf as server:

Sur un des serveurs lancer iperf en mode serveur :

[root@myserver1 root]# iperf -s

------------------------------------------------------------

Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)

 

Then run the test on the other server (in client mode where myserver1 is the name of the server running iperf -s):

Ensuite lancer le test sur l’autre serveur (en mode client où myserver1 est le nom du serveur sur lequel est lancé iperf –s) :

D:\>iperf –c myserver1

------------------------------------------------------------

Client connecting to myserver1, TCP port 5001

TCP window size: 63.0 KByte (default)

------------------------------------------------------------

[1852] local 192.168.1.101 port 36794 connected with 192.168.1.120 port 5001
[ ID] Interval       Transfer     Bandwidth
[1852]  0.0-10.0 sec  1.07 GBytes    921 Mbits/sec

 

Most of the time you will want to run the test with option –r to detect any asymmetric rate issue.

La plus part du temps il faudra lancer le test avec l’option –r pour détecter les problèmes de débit asymétrique :

[root@ myserver3 root] # iperf -c myserver1 -r

------------------------------------------------------------

Server listening on TCP port 5001

TCP window size: 85.3 KByte (default)

------------------------------------------------------------

------------------------------------------------------------

Client connecting to frsu0069, TCP port 5001

TCP window size:   128 KByte (default)

------------------------------------------------------------

[  4] local 192.168.1.102  port 34743 connected with 192.168.1.120 port 5001

[  4]  0.0-10.0 sec    112 MBytes  94.3 Mbits/sec

[  4] local 192.168.1.102  port 5001 connected with 192.168.1.120 port 53073

[  4]  0.0-10.0 sec    112 MBytes  94.1 Mbits/sec

 

You can easily find iperf rpm for you distribution, for Windows and other operating systems here is a link :

Vous pouvez facilement touver le rpm pour votre distribution, pour Windows et les autre systems d’exploitation voice un lien :

iperf download

 

 

Glances: installing and tuning default thresholds on RedHat ES6

Glances is a free (under LGPL license) tool, written by Nicolas HENNION (aka Nicolargo) in Python and using libstatgrab to monitor your system.

I like the concept and it’s very easy to install and to handle.

I used to work a lot with top and sar on linux but now if I have the opportunity to install Glances, I do it.

Conceptually Glances is more like nmon on AIX, or glance on HP-UX (quite the same name, what a coincidence?).

Installation:

Download Glances (1.3.7 on this post) :

Compile glance (you will need gcc) :

# tar ztf glances-1.3.7.tar.gz
# cd glances-1.3.7/
# ./configure
# make
# make install

Then install libstatgrab and pystatgrab librairies.

# rpm -Uvh libstatgrab-0.15-1.el6.rf.x86_64.rpm
# rpm -Uvh pystatgrab-0.5-9.el6.x86_64.rpm

You will not found the 2 rpm on RH ES6 CDs but you can find them on rpm.pbone.net for instance.

Don’t try to install pystatgrab from the sources: it won’t work as it uses pkg-config and pkg-config is not able to locate the libs on RedHat (don’t now why?).

Run Glances:

# glances.py

Glances: installing and tuning

From the screenshot one can see that the server’s main statistics are available on one screen:

Cpu, load, Memory, Network, Disk I/O, Disk space, and process

For the monitoring part you have colors for current thresholds overflow and an history of the last 3 to 10 warning and critical alerts.

For more information see the man page or Nicolargo’s web site (in French):

nicolargo Glances doc

If you want to change the default limits, you will have to edit glances.py

# locate glances.py
/usr/local/bin/glances.py
# vi /usr/local/bin/glances.py

Find glancesLimits class :

class glancesLimits():
"""
Manage the limit OK,CAREFUL,WARNING,CRITICAL for each stats
"""
# The limit list is stored in an hash table:
#  limits_list[STAT] = [ CAREFUL , WARNING , CRITICAL ]
# Exemple:
#  limits_list['STD'] = [ 50, 70 , 90 ]
 
__limits_list = {   #           CAREFUL WARNING CRITICAL
'STD':  [50,    70,     90],
'LOAD': [0.7,   1.0,    5.0]
}

And modify the default limits, for instance:

__limits_list = {   #           CAREFUL WARNING CRITICAL
'STD':  [40,    50,     70],
'LOAD': [0.2,   0.5,    1.0]

Glances: tuning default thresholds

Now you can see that while cpu% user if still lower than 90, the color is now red, meaning CRITICAL and the process who were in CAREFUL state before (<70) are now in WARNING state. Same comment on the load.

Escape command alias “\” – Commande d’échappement d’alias “\”

Escape command alias - Commande d'échappement d'alias

To avoid using an alias instead of the “true” command, the syntax is:

Pour éviter d’utiliser un alias au lieu de la “vraie” commande, la syntaxe est :

\[command]

Example:

# alias
alias la='/bin/ls -laF --color=auto'
alias ll='/bin/ls -laF --color=auto'
alias ls='/bin/ls -laF --color=auto'
alias md='mkdir'
alias rd='rmdir'
alias which='type -P'

For instance, if I try to use “ls -1” in order to list the content of the current directory on 1 column, the result would be overwritten by the alias: “ls -1” would be “ls –laF1” which is the same as “ls –laF”.

Par exemple, si je veux utiliser “ls -1” pour lister le contenu du répertoire courant sur 1 colonne, l’alias prendra le pas : “ls -1” deviendra “ls -laF1” qui est la même chose que “ls -laF”

# ls -1
total 872
drwx------    2 root     root         4096 Oct 10 13:07 ./
drwxr-xr-x    4 root     root         4096 Apr  8  2011 ../
-rw-------    1 root     root        12444 Dec 16  2004 auto.home
-rw-------    1 root     root        12608 Apr  8  2011 group.bygid
-rw-------    1 root     root        12624 Apr  8  2011 group.byname
-rw-------    1 root     root        13027 Apr  8  2011 netgroup
-rw-------    1 root     root        12520 Apr  8  2011 netgroup.byhost
-rw-------    1 root     root        13135 Apr  8  2011 netgroup.byuser
-rw-------    1 root     root        19832 Apr  8  2011 passwd.byname
-rw-------    1 root     root        19541 Apr  8  2011 passwd.byuid
-rw-------    1 root     root       450607 Jan  2  2007 printcap
-rw-------    1 root     root        50425 Feb 27  2007 services.byname
-rw-------    1 root     root       100033 Apr  8  2011 services.byservicename
-rw-------    1 root     root        12702 Apr  8  2011 ypservers

 
If you want the command to react normally you will have to remove the alias:

Si vous voulez que la commande réagisse normalement il faudra supprimer l’alias :

# unalias ls

Or if it’s just a one-time command, use “\”:

Ou si c’est seulement exceptionnel, utilisez “\” :

# \ls -1
auto.home
group.bygid
group.byname
netgroup
netgroup.byhost
netgroup.byuser
passwd.byname
passwd.byuid
printcap
services.byname
services.byservicename
ypservers

 

How to setup iSCSI on Linux (RedHat)

Definitions:

iSCSI initiator : the endpoint that initiates a iSCSI session.  An iSCSI initiator sends SCSI commands over an IP network. It’s the client endpoint.

iSCSI Target : refers to a storage resource located on an iSCSI server (most of the time it’s a “storage array”). It’s the server endpoint.

LUNs (Logical Number Units): number used to identify a logical unit, which is a device addressed by the SCSI protocol (thus Fiber Channel or iSCSI). It usually represents slices of large RAID disk arrays.

IQN (iSCSI Qualified Name) : iSCSI name of the target or initiator.

 

On the Storage Server:

Enable and configure the iSCSI Target on your storage server.

Mine is a QNAP Turbo NAS. I’ve got 1 target with 5 LUNs configured.

SCSI Portal
 
X Enable iSCSI Target Service
 
iSCSI Service Port:           3260
 
mytarget (iqn.2004-04.com.qnap:ts-859:iscsi.mytarget.c5884b)     Connected
 
id:0 - lun1 ( 2024.00 GB)               Enabled
 
id:1 - lun2 ( 2024.00 GB)               Enabled
 
id:2 - lun3 ( 2024.00 GB)               Enabled
 
id:3 - lun4 ( 2024.00 GB)               Enabled
 
id:4 - lun5 ( 1804.13 GB)               Enabled

I have two network interfaces:

1-       for QNAP management, IP : 10.0.0.5

2-      iSCSI access, directly connected to the server : 192.168.0.1

 

For more security you can enable “LUN masking”. It will restrain iSCSI target to be accessed to only by the initiator of your client (the client initiator name IQN can be found on /etc/iscsi/initiatorname.iscsi).

 

On the Linux client (see tips ** for VMware configuration) :

Install “iscsi-initiator-utils” on the server that will connect to the iSCSI volume:

# rpm –Uvh iscsi-initiator-utils-6.2.0.865-6.el5.x86_64.rpm

Set up iscsi automatic start on boot and start iscsi services:

# chkconfig iscsid on
# service iscsid start
# chkconfig iscsi on
# service iscsi start

 

Discover your iSCSI targets:

# iscsiadm -m discovery -t st -p 192.168.0.1

In my case it will show 2 targets (one for each network connection):

192.168.0.1:3260 iqn.2004-04.com.qnap:ts-859:iscsi. mytarget.c5884b
10.0.0.5:3260 iqn.2004-04.com.qnap:ts-859:iscsi. mytarget.c5884b

I have 2 routes for the same target.

 

Log to the target through IP 192.168.0.1 :

# iscsiadm -m node -T iqn.2004-04.com.qnap:ts-859:iscsi.mytarget.c5884b -p 192.168.0.1 -l

Add automatic login at boot :

# iscsiadm -m node -T iqn.2004-04.com.qnap:ts-859:iscsi.mytarget.c5884b -p 192.168.0.1 --op update -n node.startup -v automatic

As I have another access to the target, I will disable it in order to not disturb the previous configuration:

# iscsiadm -m node -T iqn.2004-04.com.qnap:ts-859:iscsi.mytarget.c5884b -p 10.0.0.5 --logout
# iscsiadm -m node -T iqn.2004-04.com.qnap:ts-859:iscsi.mytarget.c5884b -p 10.0.0.5 --op update -n node.startup -v manual

 

At this point you will see the iSCSI LUNs as block devices on your client.

On my system the five iSCSI block devices are /dev/sdc, sdd, sde, sdf and sdg.

 

You will have create partitions and format them to either standard Linux partition or LVM partition.

I chose LVM because I need large file systems.

You can use parted or fdisk (if < 2To), see article: ” How To Make Partitions Larger Than 2To With Parted GPT Support“.

So here is the result:

# fdisk -l
Disk /dev/sdc: 2173.2 GB, 2173253451776 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      264216  2122314988+  8e  Linux LVM
Disk /dev/sdd: 2173.2 GB, 2173253451776 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      264216  2122314988+  8e  Linux LVM
Disk /dev/sde: 2173.2 GB, 2173253451776 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      264216  2122314988+  8e  Linux LVM
Disk /dev/sdf: 2173.2 GB, 2173253451776 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1      264216  2122314988+  8e  Linux LVM
Disk /dev/sdg: 1937.1 GB, 1937169711104 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1      235514  1891766173+  8e  Linux LVM

 

Then create you LVM volume group and logical volume :

# pvcreate /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1
# vgcreate -s 256M vol_vg /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1
# lvcreate -l 28672 vol_vg -n vol_lv1
# lvcreate -l 10924 vol_vg -n vol_lv2

File system creation:

# mkfs -t ext3 -b 4096 -N 100000 /dev/vol_vg/vol_lv1 -L VOL1
# mkfs -t ext3 -b 4096 -N 100000 /dev/vol_vg/vol_lv2 -L VOL2

Then mount the file systems:

# mkdir –p /VOL1 /VOL2
# mount -t ext3 /dev/vol_vg/vol_lv1 /VOL1
# mount -t ext3 /dev/vol_vg/vol_lv2 /VOL2
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vol_vg-vol_lv1 7.0T  6.3T  395G  95% /VOL1
/dev/mapper/vol_vg-vol_lv2 2.7T  1.5T  1.2T  57% /VOL2

If you will want to automatically mount your iSCSI file systems at startup (see article: How To Use UUID And Blkid To Manage Devices).

Get the UUID for each file system:

# blkid /dev/vol_vg/vol_lv1
/dev/vol_vg/vol_lv1: LABEL="VOL1" UUID="4a496f92-6840-4736-a0d5-5b9916113835" SEC_TYPE="ext2" TYPE="ext3"
# blkid /dev/vol_vg/vol_lv2
/dev/vol_vg/vol_lv2: LABEL="VOL2" UUID="cab5e3ec-4797-4227-98e8-e9bca3c3f766" SEC_TYPE="ext2" TYPE="ext3"

The add UUIDs to /etc/fstab :

UUID=4a496f92-6840-4736-a0d5-5b9916113835       /VOL1   ext3 _netdev    0 0
UUID=cab5e3ec-4797-4227-98e8-e9bca3c3f766       /VOL2   ext3 _netdev    0 0

 

** Tip :

If your Linux is a VM on ESXi :

–          Dedicate a network adapter to connect directly the Storage Array to the VMware server.

CAT 5e/6 RJ45 cable (through dedicated hardware switch, if needed).

–          Create a “vSwitch” using the dedicated network adapter with vShere Client.

vswitch iscsi

vswitch iscsi

–          Add a network adapter using the new vSwitch on your virtual host configuration.

Now you have a direct iSCSI connection to you storage array. You can start the configuration.