Proxmox ISCSI installation: Difference between revisions
Simon CORSIN (talk | contribs) |
No edit summary |
||
(16 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== 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 | == What do you need? == | ||
iSCSI | * 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 [http://etherboot.org/wiki/start 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'' | |||
<pre>apt install open-iscsi</pre> | |||
This utility manages to attach an iSCSI target to the session. | |||
* Attach the ''iSCSI target'' | |||
<pre>iscsiadm --mode node --targetname <IQN> -p <IP> --login</pre> | |||
You should now see your iSCSI target into /dev/sdX. | |||
<pre>iscsiadm --mode node --targetname | ;Example: | ||
You should now see your iSCSI target into /dev/sdX. | |||
<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> | ||
* 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 | |||
<pre>mount /dev/sdX1 /mnt/debian</pre> | <pre>mount /dev/sdX1 /mnt/debian</pre> | ||
< | * Install ''debootstrap'' | ||
<pre>apt install debootstrap</pre> | |||
This utility manages to install a light debian install by using deb packages in the target. | |||
* Install ''debian stretch'' on /mnt/debian by using debootstrap | |||
<pre>debootstrap stretch /mnt/debian http://ftp.us.debian.org/debian</pre> | |||
'''You should now have a right lightweight Stretch install on the main partition''' | |||
* ''Mount'' this system's dirs - this is necessary for preparing the new stretch 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> | ||
* Use now this Debian by using chroot (by a sn user who can change the root dir by another dir). | |||
<pre>chroot /mnt/debian</pre> | <pre>chroot /mnt/debian</pre> | ||
'''You are now logged on to your new system''' | |||
<pre> | |||
It should install Grub into the MBR of your iSCSI target. If not, you can use grub-install /dev/sdX | * Install ''Grub'' | ||
<pre>echo "deb http://download.proxmox.com/debian | <pre>apt install grub</pre> | ||
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/pve stretch pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list | |||
wget http://download.proxmox.com/debian/proxmox-ve-release-5.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpg | |||
apt update</pre> | |||
* 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: | |||
<pre>auto lo | <pre>auto lo | ||
iface lo inet loopback</pre> | iface lo inet loopback</pre> | ||
<pre> | * Install the ''proxmox kernel and headers'' | ||
This action should update grub automatically. | <pre>apt install pve-kernel pve-headers</pre> | ||
<pre> | This action should update grub automatically. | ||
<pre>echo "ISCSI_AUTO=true" | * Install ''open-iscsi'' for making this installation fully supports iSCSI | ||
By using this, you don't have to | <pre>apt install open-iscsi</pre> | ||
<pre> | |||
* 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" > /etc/iscsi/iscsi.initramfs</pre> | |||
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>apt install initramfs-tools | |||
update-initramfs -u</pre> | update-initramfs -u</pre> | ||
* Create a ''root password'' | |||
<pre>passwd</pre> | <pre>passwd</pre> | ||
<pre> | Your new Debian system should now boot over ''iSCSI''! Once booted you can install Proxmox by simply using: | ||
<pre>apt install proxmox-ve ntp ssh lvm2 </pre> | |||
[[Category: HOWTO]] |
Latest revision as of 10:40, 19 March 2019
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
apt 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
apt install debootstrap
This utility manages to install a light debian install by using deb packages in the target.
- Install debian stretch on /mnt/debian by using debootstrap
debootstrap stretch /mnt/debian http://ftp.us.debian.org/debian
You should now have a right lightweight Stretch install on the main partition
- Mount this system's dirs - this is necessary for preparing the new stretch 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 (by a sn user who can change the root dir by another dir).
chroot /mnt/debian
You are now logged on to your new system
- Install Grub
apt 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/pve stretch pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list wget http://download.proxmox.com/debian/proxmox-ve-release-5.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpg apt 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 kernel and headers
apt install pve-kernel pve-headers
This action should update grub automatically.
- Install open-iscsi for making this installation fully supports iSCSI
apt 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
apt 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:
apt install proxmox-ve ntp ssh lvm2