Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sanboot:gentoo_iscsi [2010/01/23 09:08]
gruffi created
sanboot:gentoo_iscsi [2010/10/26 07:18] (current)
ctr formating
Line 2: Line 2:
 =====  Scope  ===== =====  Scope  =====
 This How-To is intended for anyone who wants to install Gentoo Linux on an iSCSI target. This How-To is intended for anyone who wants to install Gentoo Linux on an iSCSI target.
-  * What is not covered +== What is covered: == 
-    * Understanding and configuring a network environment +    * Connecting ​to the iSCSI target
-  * What is covered +
-    * Conecting ​to the iSCSI target+
     * Installing a generic base system     * Installing a generic base system
     * Installing the kernel     * Installing the kernel
     * Installing the bootloader     * Installing the bootloader
 +== What is not covered: ==
 +    * Understanding and configuring a network environment
  
 =====  Credits ​ ===== =====  Credits ​ =====
Line 14: Line 14:
 The following pages proved to be a great resource of information:​ The following pages proved to be a great resource of information:​
  
-http:<​nowiki>​//</​nowiki>​etherboot.org/​wiki/​sanboot/​ubuntu_iscsi (installing ubuntu on iscsi)+  * http://​etherboot.org/​wiki/​sanboot/​ubuntu_iscsi (installing ubuntu on iscsi)
  
-http:<​nowiki>​//</​nowiki>​www.gentoo-wiki.info/​ISCSI (examples how to use open-iscsi on gentoo)+  * http://​www.gentoo-wiki.info/​ISCSI (examples how to use open-iscsi on gentoo)
  
-http:<​nowiki>​//</​nowiki>​www.mail-archive.com/​open-iscsi@googlegroups.com/​msg00736.html (a bug that kept me bussy for a while)+  * http://​www.mail-archive.com/​open-iscsi@googlegroups.com/​msg00736.html (a bug that kept me busy for a while)
  
 ====== ​ Installation ​ ====== ====== ​ Installation ​ ======
-=====  Connect to your iscsi disk  ===== +=====  Connect to your iSCSI disk  ===== 
-====  Method 1: use (x)ubuntu boot cd (safest) ​ ====+====  Method 1: use (x)ubuntu boot CD (safest) ​ ====
  
 (I've only tried this with xubuntu, but other ubuntu versions should work as well.) (I've only tried this with xubuntu, but other ubuntu versions should work as well.)
  
-This is by far the safest way to install, since you are booting from the live-cd, why not just disconnect all your harddrives ​to avoid mistakes?+This is by far the safest way to install, since you are booting from the live-cd. Why not just disconnect all your hard drives ​to avoid mistakes?
  
 ===  Install open-iscsi ​ === ===  Install open-iscsi ​ ===
Line 32: Line 32:
  sudo aptitude install open-iscsi</​code>​  sudo aptitude install open-iscsi</​code>​
  
-===  Discover your iscsi target ​ ===+===  Discover your iSCSI target ​ ===
 <​code>​ <​code>​
  sudo iscsi_discovery <​SAN-IP></​code>​  sudo iscsi_discovery <​SAN-IP></​code>​
Line 44: Line 44:
  sudo iscsiadm -m node -p <​SAN-IP>​ -T iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest -l</​code>​  sudo iscsiadm -m node -p <​SAN-IP>​ -T iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest -l</​code>​
  
-You should see something ​simmilar ​to:+You should see something ​similar ​to:
 <​code>​ <​code>​
  ​Logging in to [[iface:​|default,​ target: iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest,​ portal: 10.9.8.250,​3260]]  ​Logging in to [[iface:​|default,​ target: iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest,​ portal: 10.9.8.250,​3260]]
Line 52: Line 52:
  
 ===  Update kernel ​ === ===  Update kernel ​ ===
-Make sure your current kernel supports ​iscsi:+Make sure your current kernel supports ​iSCSI:
 Roll a new kernel if necessary. Roll a new kernel if necessary.
  
-I had trouble when CRC32c was compiled as M so i made it *+  * I had trouble when CRC32c was compiled as a module, but it worked when built-in
- +  ​* ​Open-iscsi will not start when ''​iSCSI Initiator over TCP/IP'' ​is built-in, ​so you have to make it a module ​for now. 
-Open-iscsi will not start when iSCSI Initiator over TCP/IP is so you have to make it for now. +  ​* ​Open-iscsi will not start when ''​iSCSI Transport Attributes'' ​is built-in, ​so you have to make it a module ​for now.
-Open-iscsi will not start when iSCSI Transport Attributes is so you have to make it for now.+
  
 <​code>​ <​code>​
Line 84: Line 83:
  * Loading iSCSI modules ...  * Loading iSCSI modules ...
  * Loading libiscsi: not found ...                                        [[|!! ]]</​code>​  * Loading libiscsi: not found ...                                        [[|!! ]]</​code>​
-then you have to addapt ​your kernel:+then you have to adapt your kernel:
 <​code>​ <​code>​
  <​M> ​  iSCSI Initiator over TCP/IP  <​M> ​  iSCSI Initiator over TCP/IP
Line 103: Line 102:
  
 ===  Discover your iscsi-target ​ === ===  Discover your iscsi-target ​ ===
-Find the mac-adres ​of your network card:+Find the MAC address ​of your network card:
 <​code>​ <​code>​
  ​ifconfig eth0 | grep HWaddr</​code>​  ​ifconfig eth0 | grep HWaddr</​code>​
Line 135: Line 134:
 You should see something like: You should see something like:
 <​code>​ <​code>​
- ​Logging in to [[iface:​|iface0,​ target: iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest,​ portal: 10.9.8.250,​3260]]+ ​Logging in to [[iface:​|iface0,​ target: iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest,​ portal: 10.9.8.250,​3260]]
  Login to [[iface:​|iface0,​ target: iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest,​ portal: 10.9.8.250,​3260]]:​ successful</​code>​  Login to [[iface:​|iface0,​ target: iqn.1986-03.com.sun:​02:​86afa64e-9baf-451c-84bb-826ea71300db.gentootest,​ portal: 10.9.8.250,​3260]]:​ successful</​code>​
  
-=====  Chroot into your iscsi-disk  =====+=====  Chroot into your iSCSI disk  =====
 (Make sure you are root from now on) (Make sure you are root from now on)
  
 ===  Find out where the disk is attached to  === ===  Find out where the disk is attached to  ===
-(In this case the "​disk"​ is a file filled with zeroes, so fdisk will complain there is no valid partition table, it does not matter.)+(In this case the "​disk"​ is a file filled with zeroes, so fdisk will complain there is no valid partition table. It does not matter.)
 <​code>​ <​code>​
  fdisk -l</​code>​  fdisk -l</​code>​
  
-You should see something ​simillar ​to:+You should see something ​similar ​to:
 <​code>​ <​code>​
  Disk /dev/sda: 4194 MB, 4194304000 bytes  Disk /dev/sda: 4194 MB, 4194304000 bytes
Line 158: Line 157:
 **WARNING: Pay attention to what device your iscsi disk is attached, if you don't have other disks connected to your computer the device will probably be /dev/sda, if you do have other disks you have to find out what device your iscsi disk is connected to! You don't want to (re)format the wrong disk! I will refer to the disk as /dev/sdX.** **WARNING: Pay attention to what device your iscsi disk is attached, if you don't have other disks connected to your computer the device will probably be /dev/sda, if you do have other disks you have to find out what device your iscsi disk is connected to! You don't want to (re)format the wrong disk! I will refer to the disk as /dev/sdX.**
  
-===  Partition the iscsi-harddisk ​ === +===  Partition the iSCSI disk  === 
-(i've made only 1 partition to make it simple, you could add boot and swap if you want)+(I've made only 1 partition to make it simple. You could add boot and swap if you want)
 <​code>​ <​code>​
  fdisk /​dev/​sdX</​code>​  fdisk /​dev/​sdX</​code>​
Line 172: Line 171:
  mkdir /​mnt/​gentoo</​code>​  mkdir /​mnt/​gentoo</​code>​
  
-===  Mount your iscsi-disk  ===+===  Mount your iSCSI disk  ===
 <​code>​ <​code>​
  mount /dev/sdX1 /​mnt/​gentoo</​code>​  mount /dev/sdX1 /​mnt/​gentoo</​code>​
  
-=====  Install Gentoo ​Base-system ​ =====+=====  Install Gentoo ​base system ​ =====
 From here on you have to download a stage3 just like you would in a normal installation. Unpack the stage in /​mnt/​gentoo. From here on you have to download a stage3 just like you would in a normal installation. Unpack the stage in /​mnt/​gentoo.
  
Line 212: Line 211:
  
 ====  Network configuration ​ ==== ====  Network configuration ​ ====
-**IMPORTANT:​** Since your storage is connected over the network do not allow init scripts to start or restart the network!+**IMPORTANT:​** Since your storage is connected over the networkdo not allow init scripts to start or restart the network!
  
 <​code>​ <​code>​
Line 221: Line 220:
  
 ====  Fstab  ==== ====  Fstab  ====
-Add your harddisk ​in fstab like any normal ​harddisk:+Add your iSCSI disk in fstab like any normal ​hard disk:
 <​code>​ <​code>​
  nano -w /​etc/​fstab</​code>​  nano -w /​etc/​fstab</​code>​
Line 239: Line 238:
  
 ====  Compile the sources with genkernel ​ ==== ====  Compile the sources with genkernel ​ ====
-Dont forget to add --iscsi for iscsi support.+Don'​t ​forget to add --iscsi for iscsi support.
 <​code>​ <​code>​
  ​genkernel --menuconfig --iscsi all</​code>​  ​genkernel --menuconfig --iscsi all</​code>​
  
-===  Enable ​(i)scsi ​ ===+===  Enable ​iSCSI  ===
 I had trouble when CRC32c was compiled as M so i made it *. I had trouble when CRC32c was compiled as M so i made it *.
  
Line 283: Line 282:
  
 =====  Install Bootloader ​ ===== =====  Install Bootloader ​ =====
-==== Install ​grub  ====+==== Install ​GRUB  ====
 <​code>​ <​code>​
  ​emerge sys-boot/​grub</​code>​  ​emerge sys-boot/​grub</​code>​
  
-====  Configure ​Grub  ====+====  Configure ​GRUB  ====
 <​code>​ <​code>​
  ​grub</​code>​  ​grub</​code>​
  
-**WARNING, WARNING, WARNING: make sure you enter the right disk!! if you are running the ubuntu-cd and don't have any real harddisks connected to your computer then hdx=hd0, if you are installing from a real harddisk ​then hdX=hd1 or hd2 or so on!!!+**WARNING, WARNING, WARNING: make sure you enter the right disk!! if you are running the ubuntu-cd and don't have any real harddisks connected to your computer then hdx=hd0, if you are installing from a real hard disk then hdX=hd1 or hd2 or so on!!!
 ** **
 <​code>​ <​code>​
Line 298: Line 297:
  ​quit</​code>​  ​quit</​code>​
  
-====  Edit grub configuration ​ ==== +====  Edit GRUB configuration ​ ==== 
-You have to set at least these options for iscsi to work:+You have to set at least these options for iSCSI to work:
 ip=dhcp, iscsi_target=,​ iscsi_address=,​ iscsi_initiatorname ====== ip=dhcp, iscsi_target=,​ iscsi_address=,​ iscsi_initiatorname ======
  
Line 319: Line 318:
  cd ~  cd ~
  ​exit</​code>​  ​exit</​code>​
-If you dont' have a boot partition like me then you can leave out /​mnt/​gentoo/​boot+If you don'have a boot partition like methen you can leave out /​mnt/​gentoo/​boot
 <​code>​ <​code>​
  ​umount /​mnt/​gentoo/​dev /​mnt/​gentoo/​proc /​mnt/​gentoo/​boot /​mnt/​gentoo</​code>​  ​umount /​mnt/​gentoo/​dev /​mnt/​gentoo/​proc /​mnt/​gentoo/​boot /​mnt/​gentoo</​code>​
  
-======  ​Troubeshooting ​ ​======+======  ​Troubleshooting ​ ​======
 =====  Made a mistake in the base system ​ ===== =====  Made a mistake in the base system ​ =====
-You can connect to your iscsi disk again with one of the methods above, chroot and fix the problem.+You can connect to your iSCSI disk again with one of the methods above, chroot and fix the problem.
 =====  System won't boot and drops you in a shell  ===== =====  System won't boot and drops you in a shell  =====
 Enter the shell and try to figure out what went wrong. Enter the shell and try to figure out what went wrong.
-  * Did the network interface come up with an ip-adres?+  * Did the network interface come up with an ip-address?
 <​code>​ <​code>​
  ​ifconfig eth0</​code>​  ​ifconfig eth0</​code>​
  
-You may have forgotten to enable ​the kernel ​ip autoconfiguration and the kernel ​dhcp +  * You may have forgotten to enable ​''​IP: ​kernel ​level  ​autoconfiguration'' ​and/or DHCP in the kernel 
- +  ​* ​You may have forgotten to enable your network card in the kernel (* not M)
-You may have forgotten to enable your network card in the kernel (* not M) +
   * Does dmesg show any warnings?   * Does dmesg show any warnings?
 <​code>​ <​code>​
Line 353: Line 350:
  ​reboot</​code>​  ​reboot</​code>​
 =====  Kernel boots but hangs/​crashes when it tries to bring up eth0  ===== =====  Kernel boots but hangs/​crashes when it tries to bring up eth0  =====
-You cannot allow the system to start or restart the network connection, this will severa ​your iscsi connection!+You cannot allow the system to start or restart the network connection, this will sever your iscsi connection!
 <​code>​ <​code>​
  ​mount ​ -o remount rw /  ​mount ​ -o remount rw /
Line 366: Line 363:
  
 =====  Boot fails when adding other storage to computer ​ ===== =====  Boot fails when adding other storage to computer ​ =====
-If you add a harddisk, usb drive, usb-stick to the computer it will probably take the /dev/sda spot and your iscsi-disk will move to /dev/sdb or/​dev/​sdc, ​or so on...+If you add a hard disk/​USB ​drive/USB stick/etc. to the computerit will probably take the /dev/sda spot and your iSCSI disk will be moved to /dev/sdb or /​dev/​sdc, ​etcUsing filesystem labels will help in this situation. 
 + 
 +=====  Gentoo will not shut down properly ​ ===== 
 +Because an iscsi mount is not recognized as netmount (like nfs) by Gentoo, the system will try to shutdown the network interface during normal shutdown/​reboot procedureThis will obviously break the iscsi connection and let the system hang. 
 + 
 +To avoid this the following workaround can be used 
 +add (where eth0 is the interface being used for the iscsi connection):​ 
 + 
 +<​code>​ 
 +/​etc/​init.d/​net.eth0 zap</​code>​
  
-====== ​ FIXME  ====== +to /​etc/​init.d/​local.start (or the start section of /​etc/​init.d/​local depending on your baselayout version). 
-Gentoo will not shut down properly.+Doing so will make Gentoo ​think eth0 is already down, so it wont try to shut it down on halt. All other init-scripts that depend on net will still be invoked to shut them down cleanly, just eth0 itself wont be stopped.

QR Code
QR Code sanboot:gentoo_iscsi (generated for current page)