- Storage costs can be saved as not all the computers/servers on your firm/lab will need to have a disk for installing an operating system.
- Storage utilization will be more efficient as the disks of the central server (In this case, your Synology NAS) can be shared among a lot of computers/servers.
- Easy to manage as the data of all the computers/servers will be stored in a central server (In this case, your Synology NAS).
- Easy to take backups of the data of your computers/servers as it will be stored in a central server (In this case, your Synology NAS).
- Snapshots of the remote disk can be taken. So, you can easily recover a computer/server from any disaster in case there’s any.
In this article, I am going to show you how to configure your Synology NAS for diskless booting Ubuntu Desktop 22.04 LTS on your computers from iSCSI SAN via iPXE. So, let’s get started.”
Table of Contents
- Technical Terms
- Network Topology
- Setting Up a Static IP Address on your Synology NAS
- Preparing Synology NAS for PXE Booting with iPXE
- Creating the Necessary iPXE Configuration Files for Diskless Booting
- Creating an iSCSI SAN for Installing Ubuntu Desktop 22.04 LTS
- Booting Ubuntu Desktop 22.04 LTS ISO Image in Live Mode
- Installing Ubuntu Desktop 22.04 LTS on an iSCSI LUN
- Configuring Ubuntu Desktop 22.04 LTS to Boot from iSCSI Disk
- Configuring iPXE to Boot from iSCSI Target
- Booting Ubuntu Desktop 22.04 LTS from iSCSI Disks via iPXE
- Conclusion
Technical Terms
SAN: The full form of SAN is Storage Area Network. It is the iSCSI server. In this case, it is your Synology NAS.
iSCSI disk/LUN: The logical disk that is shared on the network via iSCSI is called an iSCSI LUN (Logical Unit Number). In this article, I will also call it an iSCSI disk.
iSCSI Target: One or more iSCSI disks/LUNs will be mapped to an iSCSI target. You will be login into an iSCSI target to access the iSCSI disks/LUNs mapped to it.
IQN: The full form of IQN is iSCSI Qualified Name. It is a unique identifier for the iSCSI target and iSCSI client.
For more in-depth information on iSCSI and how it works, read the article Configure iSCSI Storage Server on Ubuntu 18.04 LTS.
Network Topology
The network topology used in this article is shown below. Here, I have a Synology NAS and two diskless computers, pc-01 and pc-02, connected to my home network. pc-01 has the MAC address 00:0c:29:5a:e5:56 and pc-02 has the MAC address 00:0c:29:af:38:6a. I will show you how to configure your Synology NAS and the iPXE boot server in a way that the computers pc-01 and pc-02 will automatically boot from different iSCSI disks/LUNs depending on their MAC addresses.
NOTE: Your network topology will be different. So, don’t forget to make the necessary adjustments in the later sections of this article.
Setting up a Static IP Address on Your Synology NAS
If the IP address of your Synology NAS changes frequently, you will have problems with PXE booting with iPXE and diskless booting Ubuntu Desktop 22.04 LTS on your computers.
So, it’s a good idea to set up a static IP address on your Synology NAS before you set up diskless booting from iSCSI SAN with iPXE. If you need any assistance with setting a static IP address on your Synology NAS, read the article How to Assign a Static IP Address to a Synology NAS?.
Preparing Synology NAS for PXE Booting With iPXE
Before you move any further, make sure to prepare your Synology NAS for PXE booting with iPXE.
To prepare your Synology NAS for PXE booting with iPXE, read the article How to Configure Synology NAS as PXE Boot Server for Netbooting Linux Installation Images with iPXE (BIOS and UEFI version).
Once your Synology NAS is configured for PXE booting with iPXE, you should see the following files and folder in the pxeboot shared folder of your Synology NAS.
In the config/ folder, you will see an iPXE boot configuration file boot.ipxe as well.
Make sure that you have all the necessary files and folders in the pxeboot shared folder before going any further. Don’t forget to read and follow the article How to Configure Synology NAS as PXE Boot Server for Netbooting Linux Installation Images with iPXE (BIOS and UEFI version) if you’re having any difficulties setting up iPXE on your Synology NAS.
Creating the Necessary iPXE Configuration Files for Diskless Booting
In this article, I will configure iPXE in a way that a different boot configuration file is used for each computer on the network, depending on the MAC address of the computers. This way, you can configure PXE booting for each of the computers on the network separately. You can also configure multiple boot options for each of the computers separately. This gives you a lot of flexibility.
To do what I have just explained, open the [pxeboot]/config/boot.ipxe boot configuration file with a text editor and type in the following lines of codes:
set nas_ip 192.168.0.114
set boot_url tftp://${nas_ip}/config/boot-${net0/mac:hexhyp}.ipxe
echo Booting from URL ${boot_url}
chain ${boot_url}
Here, 192.168.0.114 is the IP address of my Synology NAS. Make sure to replace it with yours from now on. If you need any assistance in finding the IP address of your Synology NAS, read the article How Do I Find the IP Address of My Synology NAS?.
Once you’re done, save the boot.ipxe configuration file.
Here, iPXE will look for boot configuration files boot-<hyphened-mac-addr>.ipxe in the config/ folder of the pxeboot shared folder. <hyphened-mac-addr> is the MAC address of the computer being booted via iPXE. So, if the computer pc-01 with the MAC address 00:0c:29:5a:e5:56 boots via iPXE, iPXE will run the boot configuration file boot-00-0c-29-5a-e5-56.ipxe. Notice how the colons (:) of the MAC address are replaced with hyphens (–).
Now, create a new boot configuration file boot-00-0c-29-5a-e5-56.ipxe for the computer pc-01 with the MAC address 00:0c:29:5a:e5:56 and type in the following lines in that file.
Once you’re done, save the boot-00-0c-29-5a-e5-56.ipxe file.
Create another boot configuration file boot-00-0c-29-af-38-6a.ipxe for the computer pc-02 with the MAC address 00:0c:29:af:38:6a and type in the following lines in that file.
Once you’re done, save the boot-00-0c-29-af-38-6a.ipxe file.
Once you’ve created the required boot configuration files, you can PXE boot the computers on your network.
In this case, if I PXE boot the computer pc-01, it will show the message Booting on pc1 as marked in the screenshot below. It means that PXE boot on pc-01 works, and iPXE read the configuration file boot-00-0c-29-5a-e5-56.ipxe when PXE booted on pc-01.
In the same way, if I PXE boot the computer pc-02, it will show the message Booting on pc2 as marked in the screenshot below. It means that PXE boot on pc-02 works, and iPXE read the configuration file boot-00-0c-29-af-38-6a.ipxe when PXE booted on pc-02.
Creating an iSCSI SAN for Installing Ubuntu Desktop 22.04 LTS
In this section, I am going to show you how to create an iSCSI target on your Synology NAS so that you can install Ubuntu Desktop 22.04 LTS on it and boot Ubuntu Desktop 22.04 LTS diskless on your computers/servers with iPXE. If you want to learn more about creating an iSCSI target on your Synology NAS, read the article How Do You Make an iSCSI Target in Synology?.
First, open the SAN Manager app from the Application Menu of the DSM web interface of your Synology NAS.
The SAN Manager app should be opened.
To create a new iSCSI target, navigate to the iSCSI section and click on the Add button.
If you have created some iSCSI targets already, then you will have to click on the Create button instead to create a new iSCSI target, as marked in the screenshot below.
iSCSI target creation wizard should be displayed. You can create a new iSCSI target from here. For more information on the available options of the iSCSI target creation wizard, read the article How Do You Make an iSCSI Target in Synology?.
I am going to show you how to create an iSCSI target for diskless booting the computer pc-01 only. You can create an iSCSI target for the computer pc-02 in the same way.
Type in pc-01-target as the iSCSI target name1, iqn.2022-05.com.linuxhint:pc-01-target as the IQN2, and click on Next3.
NOTE: IQN is a unique identifier for the iSCSI targets of your Synology NAS. The IQN follows a specific format. To learn more about IQN and its format, read the Creating an iSCSI Target section of the article How Do You Make an iSCSI Target in Synology?.
Select Create a new LUN and click on Next.
Type in pc-01-disk01 as the name for the iSCSI LUN1, select a volume where you want to store the iSCSI LUN data from the Location dropdown menu2, and type in the amount of disk space (in GB/gigabyte unit) you want to allocate for the LUN3, select a space allocation method from the Space allocation dropdown menu4, and click on Next5.
NOTE: For more information on Thin Provisioning and Thick Provisioning, read the Creating a LUN section of the article How Do You Make an iSCSI Target in Synology?.
A summary of the settings used to create a new LUN, and iSCSI target will be displayed.
To create a new LUN and iSCSI target with these settings, click on Done.
A new iSCSI target pc-01-target should be created. A new LUN pc-01-disk01 should be created and mapped to the iSCSI target pc-01-target as well.
In the same way, create a new iSCSI target pc-02-target for the computer pc-02, create a new LUN pc-02-disk01, and map it to the iSCSI target pc-02-target.
You will find a lot of information about all the LUNs that you’ve created in the LUN section of the SAN Manager app, as you can see in the screenshot below.
For iSCSI diskless booting of Ubuntu Desktop 22.04 LTS to work perfectly without any issues, you will have to enable multiple sessions to the iSCSI targets that you’ve created for the computers pc-01 and pc-02.
To enable multiple sessions for the iSCSI target pc-01-target, select it and click on Edit.
Check the Allow multiple sessions from one or more iSCSI initiators checkbox from the Advanced tab and click on Save.
Multiple sessions should be enabled for the iSCSI target pc-01-target, as you can see in the screenshot below.
In the same way, enable Multiple sessions for the iSCSI target pc-02-target.
Booting Ubuntu Desktop 22.04 LTS ISO Image in Live Mode
To install Ubuntu Desktop 22.04 LTS on the iSCSI LUNs that you’ve created in the previous section of this article, you will have to create a bootable USB thumb drive of Ubuntu Desktop 22.04 LTS using the official ISO image and boot Ubuntu Desktop 22.04 LTS on your computer from the USB bootable thumb drive in Live mode.
If you need any assistance in creating a bootable USB thumb drive of Ubuntu Desktop 22.04 LTS from the official Ubuntu Desktop 22.04 LTS ISO image, read the article Installing Ubuntu Desktop 20.04 LTS.
Once you boot from the bootable USB thumb drive of Ubuntu Desktop 22.04 LTS, you will see the following window. Click on Try Ubuntu.
Ubuntu Desktop 22.04 LTS should be running from the USB thumb drive in Live mode.
Installing Ubuntu Desktop 22.04 LTS on an iSCSI LUN
In this section, I am going to show you how to access an iSCSI target of your Synology NAS from Ubuntu Desktop 22.04 LTS Live installer and install Ubuntu Desktop 22.04 LTS on an iSCSI LUN.
For more in-depth information on iSCSI and how to use it on Ubuntu, read the article Configure iSCSI Storage Server on Ubuntu 18.04 LTS. I will show you the required commands in this section only.
First, update the APT package repository cache with the following command:
To access the iSCSI targets that you’ve created on your Synology NAS, you will need an iSCSI client installed. On Ubuntu, you can install the open-iscsi package from the official package repository to install the required iSCSI client tools.
To install the open-iscsi package on Ubuntu Desktop 22.04 LTS Live, run the following command:
To confirm the installation, press Y and then press <Enter>.
The open-iscsi package should be installed.
To discover all the iSCSI targets of your Synology NAS, run the following command:
NOTE: Here, 192.168.0.114 is the IP address of my Synology NAS. It will be different for you. So, replace it with yours from now on. If you need any assistance with finding the IP address of your Synology NAS, read the article How Do I Find the IP Address of My Synology NAS?.
As you can see the iSCSI targets (iqn.2022-05.com.linuxhint:pc-01-target and iqn.2022-05.com.linuxhint:pc-02-target) that I’ve created earlier are listed.
Now, let’s access the iSCSI target iqn.2022-05.com.linuxhint:pc-01-target and install Ubuntu Desktop 22.04 LTS on it.
To access the iSCSI target iqn.2022-05.com.linuxhint:pc-01-target from your Synology NAS, run the following command:
You should be logged in to the iSCSI target iqn.2022-05.com.linuxhint:pc-01-target.
Once you’re logged in to the iSCSI target iqn.2022-05.com.linuxhint:pc-01-target, you should see a new disk (sda in this case) on your computer. You can install Ubuntu Desktop 22.04 LTS on it as usual.
The SAN Manager app should also show you that you’re connected to the iSCSI target pc-01-target.
To install Ubuntu Desktop 22.04 LTS on the iSCSI disk, click on the marked icon to start the Ubuntu Desktop 22.04 LTS installer.
Ubuntu Desktop 22.04 LTS installer should start.
NOTE: In this article, I will do automatic partitioning and quickly go through all the installation steps. But if you want in-depth instructions on each of the installation steps and do manual partitioning, be sure to check the article Installing Ubuntu Desktop 20.04 LTS.
Click on Continue.
Select a keyboard layout and click on Continue.
Click on Continue.
Select Erase disk and install Ubuntu and click on Next.
NOTE: If you want to do manual partitioning, select Something else and click on Continue. If you need any assistance on manual partitioning, be sure to check the article Installing Ubuntu Desktop 20.04 LTS.
Click on Continue.
Select your time zone and click on Continue.
Type in your personal information and click on Continue.
The Ubuntu Desktop 22.04 LTS installer should start copying all the required files to the iSCSI disk. It will take a while to complete.
At this point, Ubuntu Desktop 22.04 LTS should be installed on the iSCSI disk.
You’re not done yet. Now, you have to mount the partitions of the iSCSI disk, chroot into the installed Ubuntu Desktop 22.04 LTS filesystem, and configure it to boot from the iSCSI disk. So, click on Continue Testing. Don’t click on Restart Now.
Configuring Ubuntu Desktop 22.04 LTS to Boot From iSCSI Disk
The iSCSI disk will be partitioned as required once Ubuntu Desktop 22.04 LTS is installed on it. You will find a 512 MB boot partition (sda1 in this case)1 and a bigger root partition (sda2 in this case)2.
Mount the root partition (sda2 in this case) first in the /mnt directory with the following command:
Once the root partition is mounted, mount the boot partition (sda1 in this case) in the /mnt/boot/efi directory with the following command:
Mount the proc filesystem in the /mnt/proc directory as follows:
Mount the sys filesystem in the /mnt/sys directory as follows:
Bind mount the /dev directory of Ubuntu Desktop 22.04 LTS Live in the /mnt/dev directory as follows:
Mount the devpts filesystem in the /mnt/dev/pts directory as follows:
Now, chroot into the installed Ubuntu Desktop 22.04 LTS on the iSCSI disk as follows:
Once you’ve successfully chrooted into the Ubuntu Desktop 22.04 LTS filesystem, you should see the following prompt:
Now, run the following command to set a default DNS nameserver on the chrooted Ubuntu Desktop 22.04 LTS:
Check if DNS names are being resolved with the following command:
Now, you have to install the open-iscsi package on the chrooted Ubuntu Desktop 22.04 LTS, configure it to automatically login to the iSCSI target, and boot from the iSCSI disk.
First, update the APT package repository cache as follows:
Install the open-iscsi package from the official Ubuntu package repository as follows:
To confirm the installation, press Y and then press <Enter>.
The open-iscsi package should be installed.
Open the /etc/iscsi/initiatorname.iscsi configuration file with the nano text editor as follows:
Set a unique IQN as the iSCSI initiator name (i.e., iqn.2022-05.com.linuxhint:ipxe.pc-01). The iSCSI client tools will use it to connect to the iSCSI targets running on your Synology NAS.
Once you’re done, press <Ctrl> + X followed by Y and <Enter> to save the initiatorname.iscsi file.
To automatically mount the iSCSI target iqn.2022-05.com.linuxhint:pc-01-target at boot time, create a new file /etc/iscsi/iscsi.initramfs and open it with the nano text editor as follows:
Set the variables ISCSI_INITIATOR, ISCSI_TARGET_NAME, and ISCSI_TARGET_IP in the iscsi.initramfs file. Once you’re done, press <Ctrl> + X followed by Y and <Enter> to save the iscsi.initramfs file.
NOTE: Here, ISCSI_INITIATOR is a unique IQN for the iSCSI client program. Set it to the same IQN as you’ve set on the /etc/iscsi/initatorname.iscsi configuration file. ISCSI_TARGET_NAME is the IQN of the iSCSI target of your Synology NAS that you want to log in to. ISCSI_TARGET_IP is the IP address of your Synology NAS. If you need an in-depth explanation of these iSCSI terms, read the article Configure iSCSI Storage Server on Ubuntu 18.04 LTS.
Now, update the initramfs with the following command:
Once the initramfs are updated, exit out of the chroot environment as follows:
Now, you can shut down your computer and boot Ubuntu Desktop 22.04 LTS from the iSCSI disk.
You can shut down your computer with the following command:
Once you see the following window, press <Enter>, and your computer should be turned off.
This is how you install Ubuntu Desktop 22.04 LTS on the iSCSI disk/LUN pc-01-disk01, configure it to automatically log in to the iSCSI target iqn.2022-05.com.linuxhint:pc-01-target and boot from it.
In the same way, you can install Ubuntu Desktop 22.04 LTS on the iSCSI disk/LUN pc-02-disk01 and configure it to boot via iSCSI as well. Just go back to the Installing Ubuntu Desktop 22.04 LTS on an iSCSI SAN section of this article and follow it. Don’t forget to make the necessary changes. That’s it.
Configuring iPXE to Boot From iSCSI Target
Now that you’ve installed Ubuntu Desktop 22.04 LTS on the iSCSI disks, it’s time to configure iPXE computer-specific boot configuration files so that you can boot Ubuntu Desktop 22.04 LTS on your computers from the iSCSI disks via iPXE.
To configure pc-01 (which has the MAC address 00:0c:29:5a:e5:56) to boot Ubuntu Desktop 22.04 LTS from the iSCSI disk pc-01-disk01 (which is mapped to the iSCSI target pc-01-target with the IQN iqn.2022-05.com.linuxhint:pc-01-target), open the iPXE boot configuration file boot-00-0c-29-5a-e5-56.ipxe with a text editor and type in the following lines:
set initiator-iqn iqn.2022-05.com.linuxhint:ipxe.pc-01
sanboot --filename \EFI\ubuntu\shimx64.efi iscsi:192.168.0.114:::1:iqn.2022-05.com.linuxhint:pc-01-target
Once you’re done, the iPXE boot configuration file boot-00-0c-29-5a-e5-56.ipxe should look as follows:
Here, iqn.2022-05.com.linuxhint:ipxe.pc-01 is the IQN of the iSCSI initiator name1. It should be the same value as you’ve set in the /etc/iscsi/initiatorname.iscsi file in the Installing Ubuntu Desktop 22.04 LTS on an iSCSI SAN section of this article.
iqn.2022-05.com.linuxhint:pc-01-target is the IQN of the iSCSI target of your Synology NAS that you want to log in and boot Ubuntu Desktop 22.04 LTS from the mapped iSCSI disk pc-01-disk012.
192.168.0.114 is the IP address of your Synology NAS3.
In the same way, you can configure pc-02 (which has the MAC address 00:0c:29:af:38:6a) to boot Ubuntu Desktop 22.04 LTS from the iSCSI disk pc-02-disk01 (which is mapped to the iSCSI target pc-02-target with the IQN iqn.2022-05.com.linuxhint:pc-02-target). Just open the iPXE boot configuration file boot-00-0c-29-af-38-6a.ipxe with a text editor, type in the same lines as in the boot configuration file boot-00-0c-29-5a-e5-56.ipxe, and make the necessary adjustments.
Booting Ubuntu Desktop 22.04 LTS From iSCSI Disks via iPXE
Now that everything is ready, you can boot the computer pc-01 via iPXE. Your computer should start booting Ubuntu Desktop 22.04 LTS from the iSCSI disk pc-01-disk01, as you can see in the screenshot below.
Shortly, you will see the GRUB menu of Ubuntu Desktop 22.04 LTS.
Select Ubuntu and press <Enter>.
Ubuntu Desktop 22.04 LTS should boot from the iSCSI disk. You will see the login screen of Ubuntu Desktop 22.04 LTS as well. Log in to the desktop using the username and password that you’ve set during the installation.
Once you’ve logged in, you can use Ubuntu Desktop 22.04 LTS on your computer as usual. You won’t need any physical disk installed on your computer.
In the same way, you can boot Ubuntu Desktop 22.04 LTS on the computer pc-02 from the iSCSI disk pc-02-disk01 via iPXE.
Conclusion
In this article, I have shown you how to configure a Synology NAS for diskless booting (from iSCSI disks) Ubuntu Desktop 22.04 LTS on the computers/servers on your network via iPXE. I have shown you how to configure iPXE to use different iPXE boot configurations for different computers/servers on your network, depending on their MAC address. This way, you will be able to configure/control booting for each of the computers/servers on the network separately and also configure multiple booting. This will also make diskless booting seamless, like booting from local disks.