Copying raw disk image (from qnap iscsi) into ZVol/Volume - correct "of=" path?

BitsAndBytes

Cadet
Joined
May 15, 2021
Messages
6
Hello,
I am migrating from a QNap to a fresh TrueNas, and trying to take disk images previously shared by iSCSI on the QNAP and load them into a new ZVol to then share via iSCSI.
I have the image file locally on the TrueNas box, but need to copy the disk image file into a precreated Zvol.

I have tried "dd if=/mnt/Pool1/Files/ServerDisk1.img of=/dev/Pool1/iSCSITargets/ServerDisk1 bs=1m"
  • /mnt/Pool1/Files/ServerDisk1.img = the "source" disk image
  • /dev/Pool1/iSCSITargets/ServerDisk1 = the destination pre-created zvol (as a block device, but created at /mnt/Pool1/iSCSITargets/ServerDisk1)
Have I completely misunderstood how this works?
Is there a better/simpler/more TrueNas way?

thanks in advance
 

no_connection

Patron
Joined
Dec 15, 2013
Messages
480
I don't even know if the image formats are compatible but you could (probably but google said it could be done) use clonezilla and copy disk from one iSCSI to the other iSCSI volume. Or use whatever transfer method you want.
 

BitsAndBytes

Cadet
Joined
May 15, 2021
Messages
6
The issue was not with the copy to the ZVol, it was due to QNAP iSCSI devices being contained in a qcow file format, so were not recognised when the initiator mounted the extent.

So, if you ever want to migrate from QNAP iSCSI to TrueNas iSCSI:
  1. Set up on the TrueNas
    1. Set up an NFS share on the TrueNas Box
    2. Set up a Jail with Qemu (pkg install qemu)
    3. Set up the ZVol to be shared via iSCSI
    4. Mount the folder that is shared via NFS into the Qemu Jail
  2. On the Qnap
    1. Export the iSCSI device from the QNAP device using the GUI to the NFS share (within the iSCSI screen)
  3. When the export is complete:
    1. Enter the Qemu jail and convert the exported QNAP file to a raw image format (qemu-img convert <Source file> <dest-file>)
    2. Copy the converted file to the ZVol block device dd if=<Converted Raw File> of=</dev/..path to zvol> bs=1m status=progress
    3. set up the iSCSI target/extent/mappings
    4. Configure the initiator to use the new target
You may be able to use the qemu-img convert to write directly to the ZVol character device, (merging steps 3.1 & 3.2) but I haven't tried this.
Cheers!
 

Xenouniv3rse

Dabbler
Joined
Feb 14, 2022
Messages
23
Hi. I want to install Kemp Load balancer and I have a .disk file. Can i convert that to zvol as well to import the vm?
 

BitsAndBytes

Cadet
Joined
May 15, 2021
Messages
6
Hi. I want to install Kemp Load balancer and I have a .disk file. Can i convert that to zvol as well to import the vm?
I have just converted a vmdk (for HomeAssistant) into a raw img file using :
qemu-img convert -f vmdk -O raw <infile> <outfile>
used dd to copy this into a new, empty zvol
created a vm using this approach (via GUI)
and it has booted fine

So I don't know if a conversion exists for the ".disk" format, but if it does, it should be possible.
 

Xenouniv3rse

Dabbler
Joined
Feb 14, 2022
Messages
23
I have just converted a vmdk (for HomeAssistant) into a raw img file using :
qemu-img convert -f vmdk -O raw <infile> <outfile>
used dd to copy this into a new, empty zvol
created a vm using this approach (via GUI)
and it has booted fine

So I don't know if a conversion exists for the ".disk" format, but if it does, it should be possible.
Hey.

I managed to sort it out and working just fine thank you!
 

HoneyBadger

actually does care
Administrator
Moderator
iXsystems
Joined
Feb 6, 2014
Messages
5,110
You may be able to use the qemu-img convert to write directly to the ZVol character device, (merging steps 3.1 & 3.2) but I haven't tried this.

Tested this one-liner out, it appears to work - you may need to add the -f <format> parameter if it's unable to detect the format automatically:

qemu-img convert -O raw /path/to/your.file > /dev/zvol/poolname/zvolname
 

Xenouniv3rse

Dabbler
Joined
Feb 14, 2022
Messages
23
I created a post on Reddit on the process i followed to install Kemp LoadMaster on Truenas. I did grab the .vmdk file instead of the .disk image

Click here to see my post.
 
Top