KVM Image
13 Replies
except that in this case you would use a raw 24 GiB single disk, /dev/sda, and you would tell it to boot in "direct-to-disk" mode.
Another exception would be that you could not use rsync as the old guide says, you would transfer the image using dd or alike, as explained here:
@sanvila:
Not in qcow format, but you can always boot your VM using a virtual rescue CD and transfer your custom image to Linode in raw mode without having to convert to raw mode first. That's basically the procedure explained here:
https://www.linode.com/docs/tools-refer … inode-vps/">https://www.linode.com/docs/tools-reference/custom-kernels-distros/running-a-custom-linux-distro-on-a-linode-vps/ except that in this case you would use a raw 24 GiB single disk, /dev/sda, and you would tell it to boot in "direct-to-disk" mode.
The source is a vmdk, can we just convert this to raw and upload it to a new Linode?
@photogbob:
The source is a vmdk, can we just convert this to raw and upload it to a new Linode?
Yes, you can.
But you can use the VM itself to "understand" the image and transfer it.
No need to convert if you don't want to.
@sanvila:
@photogbob:The source is a vmdk, can we just convert this to raw and upload it to a new Linode?
Yes, you can.But you can use the VM itself to "understand" the image and transfer it.
No need to convert if you don't want to.
Is there a way to transfer the converted image to Linode without the Finnix step? When I boot the 64 bit (and tried 32 bit) in VMWare, it just gives me a blank screen after the quick memory check and a few other lines.
Virtual /dev/sda: Your favourite distro.
Virtual /dev/sdb: The custom OS to be transferred to Linode.
It would be something like this:
cat /dev/sdb | pv | ssh -C root@123.456.789.123 "cat > /dev/sda"
@sanvila:
You don't really need Finnix in your computer. You can use a minimal Unix system as the "rescue disk":
Virtual /dev/sda: Your favourite distro.
Virtual /dev/sdb: The custom OS to be transferred to Linode.
It would be something like this:
cat /dev/sdb | pv | ssh -C root@123.456.789.123 "cat > /dev/sda"
I ended up getting it to work, I had to use Text mode under other options and I got Finnix booted. I can't seem to get the file system to mount though, I tried manually giving it ufs and so on, but it won't mount it.
Edit: Ok, I think I got it. Had to use -t ufs -o ufstype=ufs2 instead of mount -t ufs -o ufstype=44bsd which is what I saw was recommended. Doing to copy over now and will test it out.
@sanvila:
Your rescue system does not need to know what's inside the image to be able to transfer it to Linode.
You know anyway to get the image to upload to Linode when it is allocated for 200G, but it is only 1GB. I want to set it to 50G or something, but it is provisioned for 200G, so when I upload it, it says it runs out of space (using smallest Linode for testing, which is I think 25GB, but the file is less than 2GB, but I think the 200G soft provisioning is getting it to fail with an out of space error).
Uploading only part of the image should be ok as far as you are completely sure that the part you don't upload is still unused and unallocated. For example, I once created a 24 GiB disk this way:
qemu-img create linode-disk 24G
Then installed Debian on a small 2000 MB partition (/dev/vda1 in my VM) and without swap. This is what fdisk -l told me:
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 3999743 3997696 1,9G 83 Linux
So I had to transfer sectors from 0 to 3999743 and this is what I did:
head --bytes=2047868928 linode-disk | pv | ssh -C root@123.456.789.123 "cat > /dev/sda"
If your image is bigger than that, make sure all your tools are able to handle files larger than 2GiB, i.e. what's commonly called "Large File Support". For that, using a 64-bit OS may help.
@sanvila:
The smallest linode is exactly 24 GiB (i.e. 24*1024^3 bytes).
Uploading only part of the image should be ok as far as you are completely sure that the part you don't upload is still unused and unallocated. For example, I once created a 24 GiB disk this way:
qemu-img create linode-disk 24G
Then installed Debian on a small 2000 MB partition (/dev/vda1 in my VM) and without swap. This is what fdisk -l told me:
Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 3999743 3997696 1,9G 83 Linux
So I had to transfer sectors from 0 to 3999743 and this is what I did:
head --bytes=2047868928 linode-disk | pv | ssh -C root@123.456.789.123 "cat > /dev/sda"
If your image is bigger than that, make sure all your tools are able to handle files larger than 2GiB, i.e. what's commonly called "Large File Support". For that, using a 64-bit OS may help.
The image is smaller (2.4GB) but is thin provisioned for 200G in VMWare and when I am copying it to Linode I think it is trying to allocate the 200GB even though it is only using 2.4GB and I can't see any way to shrink the thin provisioning. (In VMWare land, this is typically done with VMWare tools installed and using their shrink option).
I don't have root access to the image, so I can't look at much. I only have vendor supplied username/password that gives you a different shell with totally different command set for managing the appliance.
fdisk -l is showing it is using all the sectors of a 200G disk.
I would install a small distro in the linode, say /dev/sda, so that I can then boot from it, start ssh and transfer the image to /dev/sdb.
@sanvila:
Hmm. If I'm not mistaken, the Finnix rescue disk at Linode is 32-bit. Maybe that's part of the problem.
I would install a small distro in the linode, say /dev/sda, so that I can then boot from it, start ssh and transfer the image to /dev/sdb.
It has option to do 32 or 64 at start, I had to do "Other boot profiles" and pick 64 text mode as the main one had problems under VMWare.
Whatever clever trick uses the virtualization software to avoid writing large amount of zeroes is not relevant here.
What matters is the amount of real partitions you have in your disk and their real sizes from the point of view of the running OS.
For example, let's suppose that you have a 256 MiB swap partition and a 1 GiB root partition, and the rest of the disk is unpartitioned (i.e. free to create additional partitions). Then you could in theory transfer only the first 1,25 real GiB of your disk to linode and it will work. The disk at linode will then have 256 MiB of swap, 1GiB root partition, and 22,75 GiB free to create more partitions.
On the other side, if you have a 200 GiB disk which is fully partitioned (i.e. in a way that you can't create new partitions),
then you simply can't transfer it to linode, because in theory any random sector of those 200 GiB could be in use by the underlying OS.
Hope this helps.