Mounting an ISCSI target

Support for your TonidoPlug
onedn
Rookie Tonidoid
Rookie Tonidoid
Posts: 3
Joined: Wed Dec 22, 2010 11:45 am

Mounting an ISCSI target

Postby onedn » Wed Dec 22, 2010 11:52 am

Hi,

Instead of a attached USB drive, I would like to mount a ISCSI disk which I have.

I have installed the open-iscsi package via apt-get install open-iscsi

But i have errors starting the initiator.

Looking at the logs, the following errors are seen:
---
Dec 23 00:44:04 TonidoPlug iscsid: iSCSI logger with pid=6084 started!
Dec 23 00:44:04 TonidoPlug iscsid: Missing or Invalid version from /sys/module/scsi_transport_iscsi/version. Make sure a up to date scsi_transport_iscsi module is loaded and a up todate version of iscsid is running. Exiting...
---

I looked into /lib/modules/2.6.31/kernel/drivers/scsi, there are noscsi_transport_iscsi modules.

Does it mean:
1. Tonidoplug does not support iscsi HDDs?
2. I can do it via a custom kernel or compile the modules myself.

Thanks!
L

Tuxedo
Tonido Team
Tonido Team
Posts: 1458
Joined: Wed Jan 28, 2009 11:30 pm

Re: Mounting an ISCSI target

Postby Tuxedo » Wed Dec 22, 2010 6:24 pm

Yes, the default kernel doesn't come with iscsi support.
You can compile just the modules for iscsi or recompile the kernel with builtin iscsi support.

onedn
Rookie Tonidoid
Rookie Tonidoid
Posts: 3
Joined: Wed Dec 22, 2010 11:45 am

Steps for USB boot, SSH, and ISCSI (Re:Mounting an ISCSI tar

Postby onedn » Mon Dec 27, 2010 10:21 pm

Hi all

After much trial and error, I have managed to get my TonidoPlug to connect to a QNAP ISCSI target, and along the way figured out how to boot from USB and also to get the latest 2.6.31 image onto the USB. So I thought I would share the experience and steps here for everyone to benefit.

A. CREATE USB BOOT DISK
B. SSH SECURITY FIX TO ALLOW NON-ROOT USER TO LOGIN FOR KERNEL 2.6.31 AND ABOVE (OPTIONAL)
C. COMPILING AND INSTALLING ISCSI MODULES TO ENABLE TONIDOPLUG TO MOUNT AN ISCSI TARGET

Detailed steps below.

A. CREATE USB BOOT DISK
First as recommended, if you are going to toy with your TonidoPlug, use an external USB Boot disk and keep your internal FLASH image clean.

If you followed the standard instructions on Tonidoplug support forums here.. you will end up with 2.6.30-rc6 kernel. The trick is to use the flash image here:

wget http://www.tonido.com/downloads/plug/flashfs.tar.gz (302MB file)

- this is the flash image to reset the tonidoplug to default factory settings and it has the 2.6.31 kernel image and rootfs.

1. Stop samba, and un-mount the USB disk. Note that some of you may see your USB drive mount at /media/usb0 or /media/disk1part1. Just un-mount accordingly.

Code: Select all

# /etc/init.d/samba stop
# umount /media/usb0


2. confirm your usb stick/hdd is not mounted

Code: Select all

# mount
rootfs on / type rootfs (rw)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
tmpfs on /var/cache/apt type tmpfs (rw,noatime)


3. Now, create a filesystem on your USB drive

Code: Select all

# mkfs.ext3 /dev/sda1


4. Lets mount the USB drive now and start to copy the files onto it.

Code: Select all

# mount /dev/sda1 /media/usb0


5. Now - DO NOT FOLLOW - the standard instructions in the manuals, else you will end up with kernel 2.6.30-rc6. Instead what we want to do is to extract out the files from the downloaded flashfs.tar.gz and copy them to the USB drive.

Make sure you CD into the mounted USB drive (in my case I use /media/usb0).

Code: Select all

# cd /media/usb0


Extract out the files

Code: Select all

# tar xvf flashfs.tar.gz


You will see the directory -> /flash-files, copy the files/images to /media/usb0 which becomes your root directory (/) when you boot from the USB drive later.

Code: Select all

# cd /media/usb0/flash-files
# cp uImage /media/usb0/boot/
# cp rootfs.tar.gz /media/usb0
# cp modules.tar.gz /media/usb0


No, extract out the files

Code: Select all

# cd /media/usb0
# tar xvf rootfs.tar.gz
# tar xvf modules.tar.gz


Note you do not need to copy tonidoapps from /root/app to /media/usb0/root/ since the flash image would already contain the apps, unless you have updated your apps or added in your own apps or make changes to them…

Optional:

Code: Select all

# initictl emit tstop
# cp -dpr /root/app/ /media/usb0/root/


You are done.. un-mount the USB drive and reboot. Some of you may need to do a cold-reboot (unplug out the power supply and plug it in again)

Code: Select all

# cd /root
# umount /media/usb0
# reboot


Your tonidoplug should boot off the USB drive now. A few things to note:

a. you may need to do a cold reboot (plug out the power and plug it in again to power-cycle the tonidoplug)

b. your network IP would be changed and you would need to look up your router for the DHCP assigned IP.

c. after you get your ip.. login via web to setup your 'new' tonidoplug :-)

d. to confirm you booted off your USB drive:

Code: Select all

root@tonido:~# df -H /
Filesystem             Size   Used  Avail Use% Mounted on
rootfs                 7.9G   1.5G   6.1G  20% /




B. SSH SECURITY FIX TO ALLOW NON-ROOT USER TO LOGIN FOR KERNEL 2.6.31 AND ABOVE (OPTIONAL)

In kernel 2.6.31, you need to edit the file below to fix the SSH problem to allow other non-root users to ssh into your system (assuming you want to)

Code: Select all

# vi /etc/sysctl.d/10-process-security.conf


and set the line as follows:

Code: Select all

vm.mmap_min_addr = 32768




C. COMPILING AND INSTALLING ISCSI MODULES TO ENABLED TONIDOPLUG TO MOUNT AN ISCSI TARGET

TonidoPlug default kernel DO NOT have ISCSI support, so what we need to do is to compile the ISCSI modules. So you will need to download the Linux kernel source and compile the modules and install them.

1. Get the Linux kernel source

Code: Select all

# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2


2. Extract out the source and make a soft-link /usr/src/linux

Code: Select all

# tar xvf linux-2.6.31.tar.bz2
# ln -s linux-2.6.31 linux


3. Now, get the TonidoPlug Linux compile CONFIG file from SHEEVA site, and rename it to .config so that the MAKEFILE can use it

Code: Select all

# cd /usr/src/linux
# wget http://sheeva.with-linux.com/sheeva/2.6.31/sheeva-2.6.31.config
# cp sheeva-2.6.31.config .config


4. Now we need to edit the .config file to enable ISCSI support

Code: Select all

# vi .config


Change the following lines to enable ISCSI support:

Code: Select all

CONFIG_SCSI_ISCSI_ATTRS=m
CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_TCP=m


5. Lets compile the modules. (Note that this MAKES all the modules, instead of just the modules in the SCSI directory, I would welcome the correct command to just MAKE the modules in the SCSI directory). Go for lunch.

Code: Select all

# make modules
# make modules_install
# depmod -a


6. Now install open-iscsi tools

Code: Select all

# cd
# apt-get install open-iscsi



If you compiled and installed the iscsi modules correctly, the apt-get install open-iscsi SHOULD NOT have any errors!

YOU ARE DONE! CONGRATS!

Now, just follow the usual ubuntu open-iscsi instructions and the qnap instructions to connect to the Qnap target. See http://www.qnap.com/pro_features_iSCSI_Ubuntu.asp. Note that the above instructions should work for ANY ISCSI target.

7. Just to confirm it is all working (I have mounted a 2TB ISCSI disk in /home)

Code: Select all

root@tonido:~# df -H /
Filesystem             Size   Used  Avail Use% Mounted on
rootfs                 7.9G   1.5G   6.1G  20% /

root@tonido:~# df -H /home
Filesystem             Size   Used  Avail Use% Mounted on
/dev/sdb1              2.0T   206M   1.9T   1% /home


Remember that if you want to mount the ISCSI disk every time the TonidoPlug reboots, you need to ADD the following lines into /etc/rc.local and /etc/fstab to force a re-mount of all drives/partitions specified in /etc/fstab AFTER all services have started up since ISCSI drives can only be mounted after the network is up.

/etc/rc.local

Code: Select all

mount -a


/etc/fstab

Code: Select all

/dev/sdc1 /home ext3 _netdev 0 0



-- THE END --

Wishing all a merry christmas and happy new year!

L

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: Mounting an ISCSI target

Postby madhan » Tue Dec 28, 2010 8:48 pm

Nice Write up! Will make it a sticky!

lastguy
Regular Tonidoid
Regular Tonidoid
Posts: 24
Joined: Mon Feb 07, 2011 2:39 pm

Re: Steps for USB boot, SSH, and ISCSI (Re:Mounting an ISCSI

Postby lastguy » Thu Feb 17, 2011 2:14 pm

onedn wrote:Hi all
-- THE END --
Wishing all a merry christmas and happy new year!
L


onedn,
would you mind to give me hint for my Tonido brick? After I added a user a/c and changed SSH I cannot login using SSH. I didn't try web login as it would be no use. I think the SSH has bug as you said, because same adduser command on desktop works fine, yet on Tonido it disconnect immediately after login.

So my question is w/o SSH can we flash the plug? I tried to modify the "reset passwd" script to restore ssh conf file (I added AllowUsers <newUser> without add root to the line), yet no help.

onedn
Rookie Tonidoid
Rookie Tonidoid
Posts: 3
Joined: Wed Dec 22, 2010 11:45 am

Re: Mounting an ISCSI target

Postby onedn » Thu Feb 17, 2011 6:38 pm

Hi lastguy

What is your kernel version?

In kernel 2.6.31 and above you need to make the change to the file indicated in my post to allow non root user login.

I am assuming you can ssh as root?

L

lastguy
Regular Tonidoid
Regular Tonidoid
Posts: 24
Joined: Mon Feb 07, 2011 2:39 pm

Re: Mounting an ISCSI target

Postby lastguy » Tue Feb 22, 2011 6:09 pm

onedn wrote:Hi lastguy
I am assuming you can ssh as root?
L

No I can't ssh. I can login web yet no use, cannot add it as drive under Windows.
It is a brick now after I adduser and touch SSH for the added user. adduser simply works on Linux PC and I don't know whether Tonido blocks sth. I suppose the kernel is:
Linux my.domain 2.6.30-rc6 #2 PREEMPT Wed May 20 05:42:04 MDT 2009 armv5tel GNU/Linux

Tried to modify reset passwd script to roll back yet failed. Wait for GuruPlug JTAG and hope Marvell uboot will work. any comments? At this stage can I still use ext USB to boot it? If USB can boot how I mount internal flash? (may be Ubuntu auto mount it)

sflinux
Super Tonidoid
Super Tonidoid
Posts: 49
Joined: Thu Feb 24, 2011 4:53 am

Re: Steps for USB boot, SSH, and ISCSI (Re:Mounting an ISCSI

Postby sflinux » Thu Feb 24, 2011 11:06 am

would you mind to give me hint for my Tonido brick?

Last guy I just got my Tonidoplug yesterday, and withing 30 minutes of having the plug, coincidentally did everything the same as you and also broke ssh.
I tried flashing the plug using the directions off the tonido site, but that didn't work, the tonidoplug didn't respond to a http:// to flash the plug. I tried changing the Flash config file from 0 to 1 to automatically flash the plug but that didn't seem to work for me either. I couldn't upload the shhd_config file from the http browser either. I thought I was screwed. The fix was to follow the directions on this page, to make a bootable usb drive for the tonidoplug. That drive boots with ssh support, and from there I could edit the files on the tonidoplug itself. Many thanks to onedn, This thread saved my tonidoplug, many thanks.
Now I can ssh from users besides root. Before reading this thread I couldn't ssh at all.

lastguy
Regular Tonidoid
Regular Tonidoid
Posts: 24
Joined: Mon Feb 07, 2011 2:39 pm

Re: Steps for USB boot, SSH, and ISCSI (Re:Mounting an ISCSI

Postby lastguy » Thu Feb 24, 2011 12:42 pm

sflinux wrote:
The fix was to follow the directions on this page, to make a bootable usb drive for the tonidoplug. That drive boots with ssh support, and from there I could edit the files on the tonidoplug itself.


Thanks a lot guys. Yeah I also find this post is very good.

I use GuruPlug JTAG to have it fixed. No windows driver works, Ubuntu has built in driver just set minicom to 115200, 8N1, no flow control.
TonidoPlug is SheevaPlug with UART/JTAG inside. open the box the UART J7 pins (1~4) are: GND, RxD, TxD, 3V3.

TonidoPlug SSH setup is odd. web and Ubuntu a/c are two sets. If you passwd on Ubuntu the Plug becomes a brick. Follow normal SSH setup fix it.
Anybody knows how to create a/c on this Plug?

Tuxedo
Tonido Team
Tonido Team
Posts: 1458
Joined: Wed Jan 28, 2009 11:30 pm

Re: Mounting an ISCSI target

Postby Tuxedo » Thu Feb 24, 2011 2:30 pm

If you want to create a Linux user on the plug, login as root (via SSH) and run the following commands:

Code: Select all

 # useradd -m -k /etc/skel/ <username>
# passwd <username>


Return to “TonidoPlug Support”

Who is online

Users browsing this forum: No registered users and 9 guests