Proxmox Nested Virtualization
Enable Nested
-
Change BIOS to support Intel or AMD Virtualization
-
Update Proxmox guest to use host CPU
qm set <vmid> --cpu host
This also can be selected as CPU type
Change BIOS to support Intel or AMD Virtualization
Update Proxmox guest to use host CPU
qm set <vmid> --cpu host
This also can be selected as CPU type
After Proxmox installed, I also migrate TrueNAS to Proxmox as VM
Use dd
command to copy USB drive to a disk file
dd if=/dev/sdi of=/tmp/truenas.raw bs=10m
Create a VM with SeaBIOS
Remove VM disk
Use following command to import disk
qm importdisk <vm_id> <raw_file> <storage_id>
For example
qm importdisk 100 vm.raw ds1812-vm_nfs1
Go to VM hardware page
Select unused disk and click Add button to add disk into VM
Select Options => Boot Order to check the iscsi controller
List all disks and find out the disks like to passthru
lsblk -o +MODEL,SERIAL,VENDOR
ls /dev/disk/by-id/*<SERIAL_NUM>*
qm set 100 -scsi2 <device>
Change network configuration
How to run TrueNAS on Proxmox?
Export Virtual Machine from TrueNAS and Import VM to Proxmox
Fusion reports error, and it can not connect to USB drive to boot.
Fusion does not support USB adapters for connecting displays to your virtual machines.
Note: I haven't tried to change UEFI mode to BIOS mode, maybe this is the cause.
Unable to connect a USB device to a virtual machine (2118442)
USB Device not detected by the virtual machine (57195)
Configuring the USB Controller and Connecting USB Devices
Note: I only record down the steps as draft, some steps are not required in this document, will update next time if I need to do same task.
I planed to convert TrueNAS to TrueNAS on Proxmox as many people implemented. The first step is install Proxmox.
As Proxmox uses local drive very frequently, slow USB disk is not suggested as mentioned in Internet, so I tried to convert Proxmox to iSCSI root.
Some advantages
apt upgrade
breaks installation.Other reasons
Another reason is, 10 days ago, my TrueNAS self rebooted even night, I could not find reason. And I also want to compare the performance between TrueNAS VM and Proxmox VM.
I installed Proxmox on TrueNAS VM first, then move VM EFI boot partition to physical USB drive.
Download proxmox image from Proxmox VE 7.1 ISO Installer proxmox-ve_7.1-2.iso
from website https://www.proxmox.com/en/downloads
Install proxmox in the VM with selection of zfs as filesystem.
It has 3 partitions
/
, zfsThe target is to move /
to iSCSI LUN, and others to USB drive.
After OS installed, the some system structured info as below
/boot
partition/etc/kernel/cmdline
loader/entries/entry.conf
and loader/loader.conf
Other files
/etc/default/grub
This file is used to build actual /boot/grub/grub.cfg
, it is not required unless you like to boot into grub to verify configuration, which gives more error info.
Note: I used grub to detected error in cmdline. Installation of grub on boot disk is required, and reinstall proxmox boot is needed after troubleshooting.
The service was installed by default in proxmox.
/etc/iscsi/initiatorname.iscsi
InitiatorName=<YOUR_INITIATOR_NAME>
/etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = <YOUR_USERNAME>
node.session.auth.password = <YOUR_PASSWORD>
After iscsid configuration changed, restart iscsid service is required.
systemctl restart iscsid
# iscsiadm --mode discovery --type sendtargets --portal <YOUR_TARGET_IP>
# iscsiadm --mode node --targetname <YOUR_TARGET_NAME> --portal <YOUR_TARGET_IP> --login
Note: If can not login, restart iscsid
and try again.
Use lsblk
command to identify device file, it should be something like /dev/sdX
.
Creating two partitions using fdisk, the first partition is to prepare following for future used, such as
Partition /dev/sda2: vfat, 512MB (EFI)
Partition /dev/sda3: for root filesystem (Label as )
Note: The iSCSI LUN appears as /dev/sda
FYI, the first partition can not be created using fdisk
command.
Format /dev/sda1
as vfat
mkfs.vfat /dev/sdd1
Note: The disk in VM appears as /dev/vda
mkdir /mnt/1 /mnt/2
mount /dev/vda2 /mnt/1
mount /dev/sda2 /mnt/2
cd /mnt/1
cp -a . /mnt/2/
umount /mnt/1 /mnt/2
rmdir /mnt/1 /mnt/2
Note: Do not use dd
command at this stage, because there will be two partitions have same partition id, proxmox-boot-tool
will not update correctly
/root
dataFind uuid
blkid
Attach iSCSI LUN to local disk
zpool attach rpool vda3 <partition_id of iSCSI LUN>
This is to enable ubuntu load iscsi driver during boot
echo "ISCSI_AUTO=true" > /etc/iscsi/iscsi.initramfs
update-initramfs -u
update-initramfs -v -k $(uname -r) -c
Note: I ran both update-initramfs command, one suggested by proxmox, another one I used before in other systems' migrations
/etc/kernel/cmdline
Append following code into first line
ip=192.168.1.51::192.168.1.254:255.255.255.0:<hostname>:[interface]::192.168.1.250:: ISCSI_INITIATOR=<YOUR_INITIATOR_NAME> ISCSI_TARGET_NAME=<YOUR_TARGET_NAME> ISCSI_TARGET_IP=<YOUR_TARGET_IP> ISCSI_TARGET_PORT=3260 ISCSI_USERNAME=<YOUR_USERNAME> ISCSI_PASSWORD=<YOUR_PASSWORD>
Note: interface can be empty if only has one network card.
proxmox-boot-tool refresh
Verify Proxmox boot loader files loader/entries/entry.conf
and loader/loader.conf
whether up to date.
Note: If two partitions has same partition id, the proxmox-boot-tool might updated other partition.
The early iSCSI logout, can cause BTRFS filesystem closing issue, especially on root (/
) filesystem. Disable iSCSI logout during service stop.
systemctl edit --full open-iscsi.service
Comment out following line
#ExecStop=/lib/open-iscsi/logout-all.sh
This is the first time test reboot, the outcome should be
iscsiadm
command manually. Verify using lsblk
command.zpool status
shows both local and iSCSI LUN are listed correctly.The objective of this reboot is to test iSCSI module and finding out any misconfiguration for grub.
zpool detach rpool vda3
This is to copy both BIOS boot and EFI partition. I used dd
command because the first partition could not be created manually by fdisk
, I think it can be created using proxmox-boot-tool
, but I didn't try that.
fdisk -l /dev/vda
dd
create imagedd if=/dev/vda of=/tmp/efi.dsk count=<the first sector number of root partition>
*Note: the count should be equal to the sectors cover both BIOS boot and EFI partition. Bigger is ok too, because we will remove the root partition.
dd if=/tmp/efi.dsk of=/dev/sdd
Note: /dev/sdd
is the USB device. I used another VM to do this
# fdisk /dev/sdd
d
3
w
Insert USB drive into a physical server, and boot from USB
If you have multiple network card, need to update the interface name in ip parameter in boot menu.
ip a
find correct interface name, then reboote
key to editor boot menu when showing boot menuEnter
to bootThis is a strange issue, because it only happened before I successfully booted.
ping <iSCSI server>
, verify network connectionControl-s
after iSCSI login, press Control-q
to release after detected iSCSI LUN/etc/default/grub
as listed in previous section....
GRUB_CMDLINE_LINUX_DEFAULT="ip=192.168.1.51::192.168.1.254:255.255.255.0:<hostname>:[interface]::192.168.1.250:: ISCSI_INITIATOR=<YOUR_INITIATOR_NAME> ISCSI_TARGET_NAME=<YOUR_TARGET_NAME> ISCSI_TARGET_IP=<YOUR_TARGET_IP> ISCSI_TARGET_PORT=3260 ISCSI_USERNAME=<YOUR_USERNAME> ISCSI_PASSWORD=<YOUR_PASSWORD>"
mount /dev/vda2 /boot/efi
/boot/grub/grub.cfg
and /boot/efi/EFI/ubuntu/grub.cfg
dpkg-reconfigure grub-efi-amd64
grub-install.real /dev/vda
Note: grub-install
is disabled by default
proxmox-boot-tool init /dev/vda2
proxmox-boot-tool refresh
Change bridge network interface depending on the correct physical interface.
Use following command to create zfs on USB free space
Create partition to cover USB drive free space
Create zpool
zpool create upoolb <new_free_partition>
/upoolb
directory to save ISO images or LXC templatesBoth type of data are not updated fequently.
Host Bootloader
Installation
Proxmox ISCSI installation
Install Proxmox VE on Debian Buster