Exposing ISO file as iSCSI target in Linux - ubuntu-14.04

How can i expose a iso file as iSCSI target in Linux. I tried the following,
mknod /dev/fake-dev1 b 7 201
losetup /dev/fake-dev1 1.iso
And then I modified the ietd.conf to point to the block device,
Lun 0 Path=/dev/fake-dev1,Type=blockio,ScsiId=lun0,ScsiSN=lun0 IOMode=ro
And then restarted the iscsitarget. From windows if I connect I only see it is unallocated drive and not the files.
When I insert a USB drive and point the 'Path=/dev/sdb' then the drive is seen on the Windows machine. But I am not able to get it working with a ISO file. Please let me know what am I missing here.

I am not sure why you are using mknod and losetup. They should not be needed.
Just set up a "fileio" target, and the file you point to is the ISO file itself.
For me, this looks like:
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 2]
| | o- iso1 .......................... [/alt/ISO_Images/SLE-12-SP3-Server-DVD-x86_64-Beta2-DVD1.iso (3.2GiB) write-back activated]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
For the "backend" part of the storage, and then just set it up like any other file, i.e. allocate an iSCSI target, set the LUN to point at the fileio object created above, then set up an ACL and portal for it. Again, mine looks like:
o- iscsi ............................................................................................................ [Targets: 2]
| o- iqn.2003-01.org.linux-iscsi.worklaptop.x8664:sn.c551a059614d ...................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 1]
| | o- iqn.1996-04.de.suse:01:919acd32c5a2 .................................................................. [Mapped LUNs: 1]
| | o- mapped_lun0 ................................................................................. [lun0 fileio/iso1 (rw)]
| o- luns .......................................................................................................... [LUNs: 1]
| | o- lun0 ...................................... [fileio/iso1 (/alt/ISO_Images/SLE-12-SP3-Server-DVD-x86_64-Beta2-DVD1.iso)]
| o- portals .................................................................................................... [Portals: 1]
| o- 192.168.20.2:3260 ................................................................................................ [OK]
Once this is set up, then you discover it like any other iSCSI target. In my case, I got "/dev/sdb", "/dev/sdb1", and "/dev/sdb2". The first obviously is the whole device, including the partition table. The second device is the first partition, and is the UEFI boot partition in my case. And the second partition, "/dev/sdb2", is the ISO, and was mounted read-only when I mounted it.

Related

I can't unrepresent LUN (SAN) devices from server

I've 22Tb lun from SAN Storage (HITACHI) on my Linux Server(CentOS 6.7).
I configure multipath for this lun, and now I wanna remove it.
The storage team deattach the lun from my server and when I run "multipath -ll"it still exists.
mpathf (360060e801667af00000167af0000014b) dm-2 HITACHI,OPEN-V*12
size=22T features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=0 status=enabled
|- 3:0:0:3 sdf 8:80 failed faulty running
`- 3:0:1:3 sdn 8:208 failed faulty running
this message stay until I reboot the server and i can't reboot all of my servers because they are in production environment.
anybody know what should I do?
Thanks
First you need to be sure the mpathf device is not being used:
lsof | grep mpathf
dmsetup info mpathf | grep -i open
In the dmsetup info open count needs to be equal to 0
So you are using the luns with lvm or something else, you need to remove everything from the lun.
Now you can delete sub disks with echo 1 > /sys/block/<x>/device/delete

Set lower metric on wlan

i've been looking for a solution for this for a while, hope you can help me.
I have a network at home like this.
+----------+
| INTERNET |
+-----+----+
|
+-----+----+
| CABLE |
| MODEM |
+-----+----+
|
+----------+---------+
| |
| |
+-----v-----+ +-----v-----+
+--------+ D-LINK | | D-LINK |
| | DIR-600 | | DI-524 |
| +-----------+ +-----+-----+
| | |
| | |
+ +-----+-----+ |
192.168.2.XXX---> Windows7 | |
+ | | |
| +-----------+ |
+ |Ubuntu | |
192.168.2.YYY +->Virtualbox <---Public IP ++
+-----------+
One Cable Modem with a Router (Dir-600) for local IPs, and an Access Point (DI-524) for public IPs.
On the local network i have a computer with Windows 7 and Virtualbox, In the virtualbox I have an Ubuntu 14.04 server. This server has internet conection on ETH0 with a bridged adapter, so it has a local IP like 192.168.2.XXX.
Also on the virtualbox i have set a wlan adapter with direct access to the virtual ubuntu server and connected to the DI-524 network with a public IP.
So, the ubuntu server has 2 interfaces:
ETH0 connected to local network with IP 192.168.2.XXX
WLAN1 connected to DI-524 with public IP.
What I want is:
Give WLAN1 the highest priority for internet access. And only if there is no WLAN connection, the virtual machine can access internet through ETH0.
I know it can be done changing metrics, but don't know how, i've tried many commands but nothing seems to work.
Can anybody help me?
Thanks in advance!
yes you can do that via ifmetric package install it on ubuntu then set number for example 10 to wlan0 and number 20 for eth0 it mean the highest priority number for wlan0 highest priority is 0 by default (priority denotes metric) check this topic enter link description here
but plz check your metric first via
route -n
then you can delete old metrics via something like this command
sudo route del -net default gw 192.168.2.XX netmask 0.0.0.0 dev wlan0 metric 0

Running cudaHashcat-1.33 on AWS g2.2xlarge - Error cuModuleLoad() 209 when trying cudaExample0.sh

As it says in the description I have installed cudaHashcat-1.33 on an AWS g2.2xlarge instance.
I've used the .run file to install the CUDA Toolkit and then performed this test: deviceQuery ; as explained here in the official documentation (http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#running-binaries).
Then I installed cudaHashcat-1.33, following these instructions.
sudo apt-get install p7zip-full
wget http://hashcat.net/files/cudaHashcat-1.33.7z
7za x cudaHashcat-1.33.7z
cd cudaHashcat-1.33
Then I tried to run this: cudaExample0.sh in ~/cudaHashcat-1.33/cudaExample0.sh and I end up getting this output:
cudaHashcat v1.33 starting...
Device #1: GRID K520, 4095MB, 797Mhz, 8MCU
Device #1: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702
Hashes: 6494 hashes; 6494 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes
Applicable Optimizers:
* Zero-Byte
* Precompute-Init
* Precompute-Merkle-Demgard
* Meet-In-The-Middle
* Early-Skip
* Not-Salted
* Not-Iterated
* Single-Salt
* Scalar-Mode
* Raw-Hash
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 80c
ERROR: cuModuleLoad() 209
A second example is this one, where I actually use the file I want to attack.
ubuntu#ip-172-31-58-154:~$ ~/maskprocessor/src/mp64.bin ?l?l?l?l?l?l?l?l | ~/cudaHashcat-1.33/cudaHashcat64.bin -m 2500 xxx.hccap
cudaHashcat v1.33 starting...
Device #1: GRID K520, 4095MB, 797Mhz, 8MCU
Device #1: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702
Hashes: 1 hashes; 1 unique digests, 1 unique salts
Bitmaps: 8 bits, 256 entries, 0x000000ff mask, 1024 bytes
Rules: 1
Applicable Optimizers:
* Zero-Byte
* Single-Hash
* Single-Salt
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 80c
ERROR: cuModuleLoad() 209
nvidia-smi
[root#ip-xxx-xxx-xxx-xxx cudaHashcat-1.33]$ nvidia-smi
Wed Mar 4 19:07:35 2015
+------------------------------------------------------+
| NVIDIA-SMI 340.32 Driver Version: 340.32 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GRID K520 On | 0000:00:03.0 Off | N/A |
| N/A 43C P8 17W / 125W | 10MiB / 4095MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Compute processes: GPU Memory |
| GPU PID Process name Usage |
|=============================================================================|
| No running compute processes found |
+-----------------------------------------------------------------------------+
If someone knows what is going on, I'd appreciate any help.
So after a lot of searching through forums I finally found an answer. #Robert Crovella, thanks for pointing out that the driver was the wrong one. So it turns out that finding the linux drivers for NVIDIA is not that easy, but I came across this page, which then lead me to the Linux Drivers of NVIDIA. Just download the driver required for your architecture (if you use wget click on 'Download' first, since there is an acceptance page). After that do 'chmod +x nvidia-driver.run' and then install it with 'sudo ./nvidia-driver.run'.
Hope that my experience helps someone else.

What is at physical memory 0x8000 (32Kb) to 0x10000 (1Mb) on Linux

I'm compiling the kernel with a custom kernel module that prints out the kernel's code start and end (physical) addresses. It starts at 0x8000 and ends at 0xefe6d8. Looking through the generated System.map, I see that almost all functions in the kernel sit at 0x10000 (1Mb) in physical memory and onwards. But the code starts at 0x8000. I cannot figure out what lives in between those two addresses. Can anyone shed some light on this?
Snippet from System.map (virtual mapping starts on 0xc0000000):
c0008000 T _text
c0008000 T stext
c000804c t __create_page_tables
c000814c t __turn_mmu_on_loc
c0008158 t __vet_atags
c0100000 T __exception_text_start
The __create_page_tables function is indicative that the page tables live after the __vet_atags code. But why would they be part of executable memory?
From the kernel boot procotol, the kernel memory layout is as follows:
~ ~
| Protected-mode kernel |
100000 +------------------------+
| I/O memory hole |
0A0000 +------------------------+
| Reserved for BIOS | Leave as much as possible unused
~ ~
| Command line | (Can also be below the X+10000 mark)
X+10000 +------------------------+
| Stack/heap | For use by the kernel real-mode code.
X+08000 +------------------------+
| Kernel setup | The kernel real-mode code.
| Kernel boot sector | The kernel legacy boot sector.
X +------------------------+
| Boot loader | <- Boot sector entry point 0000:7C00
001000 +------------------------+
| Reserved for MBR/BIOS |
000800 +------------------------+
| Typically used by MBR |
000600 +------------------------+
| BIOS use only   |
000000 +------------------------+

Re-scan LUN on Linux

We have expend existing LUN size on EMC Storage and now i want to re-scan on Host side but i don't know how to figure out SCSI ID of that specific LUN. I am new to storage.. This is what i am doing but don't know whether it is a right way or not
Pseudo name=emcpowerj
CLARiiON ID=APM00112500570 [Oracle_Cluster]
Logical device ID=200601602E002900B6BCA114C9F8E011 [LUN01]
state=alive; policy=CLAROpt; priority=0; queued-IOs=0;
Owner: default=SP A, current=SP A Array failover mode: 1
==============================================================================
--------------- Host --------------- - Stor - -- I/O Path -- -- Stats ---
### HW Path I/O Paths Interf. Mode State Q-IOs Errors
==============================================================================
2 qla2xxx sdaj SP A1 active alive 0 1
2 qla2xxx sdaw SP B1 active alive 0 4
1 qla2xxx sdj SP A0 active alive 0 1
1 qla2xxx sdw SP B0 active alive 0 4
Here i am running find command on sdX device to find out SCSI ID to i can do echo 1 > /sys/bus/scsi/drivers/X:X:X:X/rescan to do re-scan LUN
$ find /sys/devices -name "*block*" | grep -e "sdaj" -e "sdaw" -e "sdj" -e "sdw"
/sys/devices/pci0000:00/0000:00:09.0/0000:05:00.1/host2/rport-2:0-1/target2:0:1/**2:0:1:8**/block:sdaw
/sys/devices/pci0000:00/0000:00:09.0/0000:05:00.1/host2/rport-2:0-0/target2:0:0/**2:0:0:8**/block:sdaj
/sys/devices/pci0000:00/0000:00:09.0/0000:05:00.0/host1/rport-1:0-1/target1:0:1/**1:0:1:8**/block:sdw
/sys/devices/pci0000:00/0000:00:09.0/0000:05:00.0/host1/rport-1:0-0/target1:0:0/**1:0:0:8**/block:sdj
or there is a alternative or other way to scan LUN?
I like to use the "lsscsi" program, which is probably available for your distribution.
% lsscsi
[0:0:0:0] cd/dvd NECVMWar VMware IDE CDR00 1.00 /dev/sr0
[2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
[2:0:1:0] disk VMware, VMware Virtual S 1.0 /dev/sdb
As for rescanning the bus, that's pretty much it.

Resources