Difference between revisions of "Proxmox ISCSI installation"

From Proxmox VE
Jump to: navigation, search
m
Line 11: Line 11:
 
== Here we go ! ==
 
== Here we go ! ==
  
<u>'''1 -'''</u> Install a clean ''Debian'' on a physical machine or into a VM. Using a VM is not a problem because we only need this for formating and installing another Debian on the iSCSI target.  
+
* Install a clean ''Debian'' on a physical machine or into a VM. Using a VM is not a problem because we only need this for formating and installing another Debian on the iSCSI target.  
 
+
* Install ''open-iscsi''  
<u>'''2 -''' </u>Install ''open-iscsi''  
 
 
<pre>aptitude install open-iscsi</pre>  
 
<pre>aptitude install open-iscsi</pre>  
This util manages to attach an iSCSI target to the session.<br><br> <u>'''3 -'''</u> Attach the ''iSCSI target''  
+
This utility manages to attach an iSCSI target to the session.
<pre>iscsiadm --mode node --targetname &lt;IQN&gt; -p &lt;IP&gt; --login</pre>  
+
* Attach the ''iSCSI target''  
You should now see your iSCSI target into /dev/sdX. '''<br>Example&nbsp;:'''
+
<pre>iscsiadm --mode node --targetname <IQN> -p <IP>; --login</pre>  
 +
You should now see your iSCSI target into /dev/sdX.
 +
;Example:  
 
<pre>iscsiadm --mode node --targetname iqn.2006-01.openfiler.com:tsn.dcb5e30d5a -p 188.102.200.254 --login</pre>  
 
<pre>iscsiadm --mode node --targetname iqn.2006-01.openfiler.com:tsn.dcb5e30d5a -p 188.102.200.254 --login</pre>  
<u>'''4 -'''</u> Create all ''partitions'' you need for your future Debian installation (you can use ''gpart'' for exemple).  
+
* Create all ''partitions'' you need for your future Debian installation (you can use ''gpart'' for example).  
 
+
;NOTE:
<u>'''NOTE&nbsp;:'''</u> '''The first partition must begin at the 2048 sector&nbsp;!!! If don't, you will not be able to install Grub on the iSCSI target&nbsp;!'''<br><br><u>'''5 -'''</u> Create a dir into /mnt (for example /mnt/debian) for preparing ''mouting''.<br><br><u>'''6 -'''</u> Mount the ''iSCSI target's'' main partition on this dir  
+
:The first partition must begin at the 2048 sector&nbsp;!!! If don't, you will not be able to install Grub on the iSCSI target&nbsp;!
 +
* Create a dir under /mnt (for example /mnt/debian) for ''mounting''
 +
* Mount the ''iSCSI target's'' main partition on this dir  
 
<pre>mount /dev/sdX1 /mnt/debian</pre>  
 
<pre>mount /dev/sdX1 /mnt/debian</pre>  
<u>'''7 -'''</u> Install ''debootstrap''  
+
*Install ''debootstrap''  
 
<pre>aptitude install debootstrap</pre>  
 
<pre>aptitude install debootstrap</pre>  
This utils manages to install a light debian install by using deb packages to a target. <u>'''<br><br>8 -'''</u> Install a ''debian squeeze'' to /mnt/debian by using debootstrap  
+
This utility manages to install a light debian install by using deb packages in the target.
 +
* Install ''debian squeeze'' on /mnt/debian by using debootstrap  
 
<pre>debootstrap squeeze /mnt/debian http://ftp.us.debian.org/debian</pre>  
 
<pre>debootstrap squeeze /mnt/debian http://ftp.us.debian.org/debian</pre>  
You can also install another debian like lenny, but squeeze supports iSCSI better (you need to do more tricks on Lenny for having a functional iscsi boot). This can take some time (depending on your connection).<br><br> <u>'''You should now have a right lightweight Squeeze install on the main partition'''</u>
+
You can also install another debian like lenny, but squeeze supports iSCSI better (you need to do more tricks on Lenny for having a functional iSCSI boot). This can take some time (depending on your connection).
 +
 
 +
'''You should now have a right lightweight Squeeze install on the main partition'''  
  
<br> <u>'''9 -'''</u> ''Mount'' this system's dirs, it is necessary for preparing the new squeeze installation for iscsi booting.  
+
* ''Mount'' this system's dirs - this is necessary for preparing the new squeeze installation for iSCSI booting.  
 
<pre>mount -o bind /dev /mnt/debian/dev
 
<pre>mount -o bind /dev /mnt/debian/dev
 
mount -o bind /sys /mnt/debian/sys
 
mount -o bind /sys /mnt/debian/sys
 
mount -o bind /proc /mnt/debian/proc</pre>  
 
mount -o bind /proc /mnt/debian/proc</pre>  
<br> <u>'''10 -''' </u>Use now this Debian by using chroot (who can change the root dir by another dir).  
+
* Use now this Debian by using chroot (who can change the root dir by another dir).  
 
<pre>chroot /mnt/debian</pre>  
 
<pre>chroot /mnt/debian</pre>  
<br> <u>'''You are now logged on your new system'''</u>
 
  
<br> <u>'''11 -'''</u> Install ''Grub''  
+
'''You are now logged on to your new system'''  
 +
 
 +
* Install ''Grub''  
 
<pre>aptitude install grub</pre>  
 
<pre>aptitude install grub</pre>  
It should install Grub into the MBR of your iSCSI target. If not, you can use grub-install /dev/sdX. <u>'''<br><br>12 -'''</u> Add the ''Proxmox repository'' and update  
+
It should install Grub into the MBR of your iSCSI target. If not, you can use <tt>grub-install /dev/sdX</tt>
 +
* Add the ''Proxmox repository'' and update  
 
<pre>echo "deb http://download.proxmox.com/debian lenny pve" &gt;&gt; /etc/apt/sources.list
 
<pre>echo "deb http://download.proxmox.com/debian lenny pve" &gt;&gt; /etc/apt/sources.list
 
wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
 
wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
 
aptitude update</pre>  
 
aptitude update</pre>  
<u>'''13 -'''</u> Add the ''loopback interface'' (if not, you will not be able to use ''nfs-common'' which is needed by the pve-manager). For this, edit:  
+
* Add the ''loopback interface'' (if not, you will not be able to use ''nfs-common'' which is needed by the pve-manager). For this, edit:  
 
<pre>nano /etc/network/interfaces</pre>  
 
<pre>nano /etc/network/interfaces</pre>  
 
and append this to it:  
 
and append this to it:  
 
<pre>auto lo
 
<pre>auto lo
 
iface lo inet loopback</pre>  
 
iface lo inet loopback</pre>  
<u>'''14 -''' </u>Install the ''proxmox 2.6.32-4 kernel and headers'' (the 2.6.35 seems to not work with iscsi booting)  
+
 
 +
* Install the ''proxmox 2.6.32-4 kernel and headers'' (the 2.6.35 seems to not work with iSCSI booting)  
 
<pre>aptitude install pve-kernel-2.6.32-4-pve pve-headers-2.6.32-4-pve</pre>  
 
<pre>aptitude install pve-kernel-2.6.32-4-pve pve-headers-2.6.32-4-pve</pre>  
This action should update grub automatically. <br><br> <u>'''15 -'''</u> Install ''open-iscsi'' for making this installation fully supports iSCSI  
+
This action should update grub automatically.
 +
* Install ''open-iscsi'' for making this installation fully supports iSCSI  
 
<pre>aptitude install open-iscsi</pre>  
 
<pre>aptitude install open-iscsi</pre>  
<u>'''16 -'''</u> Precise to open-iscsi to manage ''iBFT informations'' (iBFT are informations made by iSCSI boot firmware like iPXE for the system)  
+
* Use open-iscsi to manage ''iBFT information'' (iBFT are information made by iSCSI boot firmware like iPXE for the system)  
<pre>echo "ISCSI_AUTO=true" &gt; /etc/iscsi/iscsi.initramfs</pre>  
+
<pre>echo "ISCSI_AUTO=true" > /etc/iscsi/iscsi.initramfs</pre>  
By using this, you don't have to precise the iSCSI IQN and the iSCSI Target's IP to the system, only iscsi boot firmware need this. <br><br><u>'''17 -'''</u> Install ''initramfs-tools'' and update initramfs  
+
By using this, you don't have to use the iSCSI IQN and the iSCSI Target's IP to access the system; only iSCSI boot firmware needs this.
 +
* Install ''initramfs-tools'' and update initramfs  
 
<pre>aptitude install initramfs-tools
 
<pre>aptitude install initramfs-tools
 
update-initramfs -u</pre>  
 
update-initramfs -u</pre>  
<u>'''18 -'''</u> Create a ''root password''  
+
* Create a ''root password''  
 
<pre>passwd</pre>  
 
<pre>passwd</pre>  
<br> Your new Debian system should now boot over ''iSCSI''&nbsp;! Once booted you can install proxmox by simply using&nbsp;:  
+
 
 +
Your new Debian system should now boot over ''iSCSI''&nbsp;! Once booted you can install Proxmox by simply using:  
 
<pre>aptitude install proxmox-ve-2.6.32 ntp ssh lvm2 </pre>
 
<pre>aptitude install proxmox-ve-2.6.32 ntp ssh lvm2 </pre>
  
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]

Revision as of 05:52, 1 November 2015

Introduction

iSCSI is a protocol that can communicate SCSI's commands over the network. The main advantage is that you don't need any hard drives for getting a fully functional server. This can be also realized by using a real Fiber Channel SAN, but it's a lot more expensive. A diskless server will boot over the network, acquiring its disk image from the SAN. Today, a lot of systems support iSCSI but they don't really support iSCSI install and boot (only VMWare supports that). However, you can making this work on some Linux systems using a few tricks explained here.

What do you need?

  • A functional iSCSI target (OpenFiler can be a good solution)
  • Your diskless server must support iSCSI boot (if not, you can use iPXE for that)
  • A DHCP server for network booting

You can find some tutorials about iPXE (formerly gPXE) on the gPXE wiki.

Here we go !

  • Install a clean Debian on a physical machine or into a VM. Using a VM is not a problem because we only need this for formating and installing another Debian on the iSCSI target.
  • Install open-iscsi
aptitude install open-iscsi

This utility manages to attach an iSCSI target to the session.

  • Attach the iSCSI target
iscsiadm --mode node --targetname <IQN> -p <IP>; --login

You should now see your iSCSI target into /dev/sdX.

Example
iscsiadm --mode node --targetname iqn.2006-01.openfiler.com:tsn.dcb5e30d5a -p 188.102.200.254 --login
  • Create all partitions you need for your future Debian installation (you can use gpart for example).
NOTE
The first partition must begin at the 2048 sector !!! If don't, you will not be able to install Grub on the iSCSI target !
  • Create a dir under /mnt (for example /mnt/debian) for mounting
  • Mount the iSCSI target's main partition on this dir
mount /dev/sdX1 /mnt/debian
  • Install debootstrap
aptitude install debootstrap

This utility manages to install a light debian install by using deb packages in the target.

  • Install debian squeeze on /mnt/debian by using debootstrap
debootstrap squeeze /mnt/debian http://ftp.us.debian.org/debian

You can also install another debian like lenny, but squeeze supports iSCSI better (you need to do more tricks on Lenny for having a functional iSCSI boot). This can take some time (depending on your connection).

You should now have a right lightweight Squeeze install on the main partition

  • Mount this system's dirs - this is necessary for preparing the new squeeze installation for iSCSI booting.
mount -o bind /dev /mnt/debian/dev
mount -o bind /sys /mnt/debian/sys
mount -o bind /proc /mnt/debian/proc
  • Use now this Debian by using chroot (who can change the root dir by another dir).
chroot /mnt/debian

You are now logged on to your new system

  • Install Grub
aptitude install grub

It should install Grub into the MBR of your iSCSI target. If not, you can use grub-install /dev/sdX

  • Add the Proxmox repository and update
echo "deb http://download.proxmox.com/debian lenny pve" >> /etc/apt/sources.list
wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
aptitude update
  • Add the loopback interface (if not, you will not be able to use nfs-common which is needed by the pve-manager). For this, edit:
nano /etc/network/interfaces

and append this to it:

auto lo
iface lo inet loopback
  • Install the proxmox 2.6.32-4 kernel and headers (the 2.6.35 seems to not work with iSCSI booting)
aptitude install pve-kernel-2.6.32-4-pve pve-headers-2.6.32-4-pve

This action should update grub automatically.

  • Install open-iscsi for making this installation fully supports iSCSI
aptitude install open-iscsi
  • Use open-iscsi to manage iBFT information (iBFT are information made by iSCSI boot firmware like iPXE for the system)
echo "ISCSI_AUTO=true" > /etc/iscsi/iscsi.initramfs

By using this, you don't have to use the iSCSI IQN and the iSCSI Target's IP to access the system; only iSCSI boot firmware needs this.

  • Install initramfs-tools and update initramfs
aptitude install initramfs-tools
update-initramfs -u
  • Create a root password
passwd

Your new Debian system should now boot over iSCSI ! Once booted you can install Proxmox by simply using:

aptitude install proxmox-ve-2.6.32 ntp ssh lvm2