ali aboos

Debian: open-iscsi, use iSCSI initiator to connect to a SAN

by on Jun.22, 2009, under Debian, Linux

It is actually quite easy as long as your kernel is 2.6.16 or newer. Debian supports fibre channel out of the box, and for iSCSI you only need to install the open-iscsi package (you can easily taylor this to your distro):
aptitude install open-iscsi
Once the package is installed restart the initiator:
/etc/init.d/open-iscsi restart
To find out the indentifier name take a look at initiatorname.iscsi file:
cat /etc/iscsi/initiatorname.iscsi
You can find the initiator identifier towards the bottom of the file… mine is InitiatorName=iqn.1993-08.org.debian:01:61ddbbf82a70. Once you found the name you should be able to discover the target with the following command (my LeftHandNetworks iSCSI SAN IP is 192.168.1.70):
iscsiadm -m discovery -t sendtargets -p 192.168.1.70
Make a note of the record ID (mine is iqn.2003-10.com.lefthandnetworks:sancrp:3139:debian) and connect to it using the following command:
iscsiadm --mode node --targetname iqn.2003-10.com.lefthandnetworks:sancrp:3139:debian --portal 192.168.1.70:3260 --login
Once you initiated the command your iSCSI target will become visible to the OS as an SCSI disk (/dev/sda). You can now partition, format and then mount the LUN just like any other storage device. Add the target to your fstab and it should be auto-mounted everytime your system boots.
nano /etc/fstab
and add:
/dev/sda1 /iscsi ext3 _netdev 0 0
To have the LUN mounted to /iscsi directory. It didn’t work that well in my case… fstab mounts devices early during startup and before iscsi init, and OS couldn’t find the target to mount. I ended up scripting the initiator and mount… created a file “initiscsi” in /etc/init.d directory and added the following lines:
iscsiadm --mode node --targetname iqn.2003-10.com.lefthandnetworks:sancrp:3139:debian --portal 192.168.1.70:3260 --login
sleep 5
mount -t ext3 /dev/sda1 /iscsi

I’m sure there is a proper way to have the session initiated before the mount, but I didn’t care enough to figure it out. Init and mount script will do just fine in my case since my LUN is just a storage device.

That sleep command is to make sure the LUN is visible to the OS before it’s mounted. I added the script to my startup sequence after making it executable:
chmod +x initiscsi
update-rc.d initiscsi defaults

This is of course for Debian startup.

If you are using CHAP you will need to edit your iscsid.conf file:
nano /etc/iscsi/iscsid.conf
and update it with correct authentication info:
node.startup = automatic
node.session.auth.username = username
node.session.auth.password = password
discovery.sendtargets.auth.username = username
discovery.sendtargets.auth.password = password

Save and close the file, then initiate discovery.

Added by Tim Rogers (thanks!):

If you wish to do this properly, you must change the boot order so that the disks are available when the iscsiadm daemon starts. To do this
mv /etc/rcS.d/S25open-iscsi /etc/rcS.d/S88open-iscsi
Check the etc/rcsS.d file first to check when open-iscsi is initiated. May have to change the command to relate to your particular setup. Then there is no need to set up the initiscsi file as described above if this is done.

3 Comments :, more...

Linux: nohup: Execute a command after exiting a shell

by on Jun.20, 2009, under Linux

This is quite useful. I used to push jobs to the background and then exit shell, but it wasn’t an easy task considering I have short term memory issues (not a complete retard, just too much on my mind ;)). I found this awesome little command to have the commands or scripts run right after I’m off the wagon!

nohup

That’s it… simply run your comman with it:
nohup command

Don’t forget the ampersand at the end. Use absolute path for scripts:
nohup ~/script &

If your scripts requires additional options to run, use a quote right before the ampersand:
nohup ~/script "start" &

Note that you don’t need to use this for your wget command… wget comes with a built-in switch (b):
wget -b

Have fun!

2 Comments more...

Linux: Convert .bin/.cue images to .iso

by on Jun.20, 2009, under Linux

Install bchunk, then:
bchunk filename.bin filename.cue filename.iso

To mount:
mount -o loop filename.iso mountpoint

Leave a Comment more...

Linux: View and manage processes running in the background

by on Jun.14, 2009, under Linux

To view all processes:
ps aux
Search for a process by name:
pgrep <string> | xargs ps
To view all processes, line by line (hit enter to view the next process, hit q to exit):
ps aux | less
To view every process:
ps -A or ps -e
All processes running by a user:
ps -u username
All processes except the ones running by root:
ps -U root -u root -N
To kill a process, either find the process name and type:
kill -9 processname
or kill the process ID (PID):
kill pid
Stop/suspend a process:
ctrl-z
Push a job to run in the background:
fg pid

2 Comments : more...

Backup Exec: Transfer scheduled jobs, database and settings to a new backup server

by on May.20, 2009, under Misc

Well… it’s quite easy especially if you are keeping the same server name (skip the SQL commands below and go right to transfer section). If not you will have to change your SQL instance name accordingly.

Start here if you’re changing the server name, otherwise skip the SQL commands below:

Open command prompt and type the following:
osql -E -S servername\BKUPEXEC
use bedb
UPDATE DataPartition SET PartitionName='SERVERNAME' WHERE PartitionID = 0
SELECT partitionname FROM datapartition
go

Then proceed with tranferring your db over to the new server. Two folders under Backup Exec installation folder are needed: Data and Catalogs. After backing up your current folders:

Stop all Backup Exec services. I’d open the console and go to Tools – Backup Exec Services and stop all.
Stop all SQL services in services console.
Copy the above folders to your new server and overwrite all existing files.
Run BEUtility.exe under Backup Exec folder. You will be prompted not to use the utility without supervision… right! Just click it away.
In the left pane click on All Media Servers, and in the right pane right click on your server name and click Copy Database.
Browse to bedb_dat.mdf (database file) and bedb_log.ldf (database log file) you just copied over from the old server.
Click OK and proceed with the transfer.

BEUtility will transfer your settings and detach/attach your database and start your BE services automatically. If not then start them manually.

If you don’t see an error message about unsuccessful db detach/attach and your services start in timely fashion then you should be able to see all your jobs, media, devices and even settings and encryption keys transferred to the new server.

7 Comments : more...

Search InsaneLabs.com

Can't find what you're looking for? Drop a comment on a post or email (ali aht insanelabs doht com)

Links

Links open in a new window