Setting up swapspace version 1, size = 1048572 KiB Use mkswap command to enable swap area on the file, run ~]# mkswap /swap_file Secure the swap file by setting the permissions as ‘600’, run beneath chmod command, ~]# chmod 600 /swap_file Step 3) Enable the Swap Area on Swap File $ sudo fallocate -l 1G /swap_file Step 2) Secure the swap file We can also use fallocate command to create a file, example is show below.
Replace the value of ‘ bs‘ and ‘ count‘ according your requirement. Run following dd command to create a file of size 1GB, ~]# dd if=/dev/zero of=/swap_file bs=1G count=1ġ073741824 bytes (1.1 GB) copied, 414.898 s, 2.6 MB/s So we will be extending swap space by 1 GB.
In conclusion, we have discussed how to convert disk images to various formats using qemu-img in Ubuntu.In my case, swap partition is of 2 GB. Convert VHD image to VMDK: qemu-img convert -f vpc image.vhd -O vmdk image.vmdk Convert VHD image to VDI: qemu-img convert -f vhd image.vhd -O vdi image.vdi Convert VHD image to Qcow2: qemu-img convert -f vpc image.vhd -O qcow2 image.qcow2
Convert VHD image to RAW: qemu-img convert -f vpc image.vhd -O raw image.raw Convert VMDK image to VHD: qemu-img convert -f vmdk image.vmdk -O vpc image.vhd Convert VHD image to RAW, Qcow2, VDI & VMDK Convert VMDK image to VDI: qemu-img convert -f vmdk image.vmdk -O vdi image.vdi Convert VMDK image to Qcow2: qemu-img convert -f vmdk image.vmdk -O qcow2 image.qcow2 Convert VMDK image to RAW: qemu-img convert -f vmdk image.vmdk -O raw image.raw Convert VDI image to VHD: qemu-img convert -f vdi image.vdi -O vpc image.vhd Convert VMDK image to RAW, Qcow2, VDI & VHD Convert VDI image to VMDK: qemu-img convert -f vdi image.vdi -O vmdk image.vmdk Convert VDI image to Qcow2: qemu-img convert -f vdi image.vdi -O qcow2 image.qcow2 Convert VDI image to RAW: qemu-img convert -f vdi image.vdi -O raw image.raw Convert Qcow2 image to VHD: qemu-img convert -f qcow2 image.qcow2 -O vpc image.vhd Convert VDI image to RAW, Qcow2, VMDK & VHD Convert Qcow2 image to VMDK: qemu-img convert -f qcow2 image.qcow2 -O vmdk image.vmdk Convert Qcow2 image to VDI: qemu-img convert -f qcow2 image.qcow2 -O vdi image.vdi Convert Qcow2 image to RAW: qemu-img convert -f qcow2 image.qcow2 -O raw image.raw Convert Raw image to VHD: qemu-img convert -f raw image.raw -O vpc image.vhd Convert Qcow2 image to RAW, VDI, VMDK & VHD Convert Raw image to VMDK: qemu-img convert -f raw image.raw -O vmdk image.vmdk Convert Raw image to VDI: qemu-img convert -f raw image.raw -O vdi image.vdi Convert Raw image to Qcow2: qemu-img convert -f raw image.raw -O qcow2 image.qcow2
Hence – sudo apt install qemu-utils Convert RAW image to Qcow2, VDI, VMDK & VHD Now, qemu-img command-line utility is packaged with qemu-utils.
So, issue the following in terminal – sudo apt update Therefore, we need to first update the repository.
The required package is already available in standard Ubuntu repository. In case you don’t have one, then contact your System Administrator for assistance. Note: Following operations would require you to have superuser privileges. Furthermore depending on virtualization used, different disk images are utilized by different applications like QEMU/KVM, VirtualBox etc.įirst we would discuss how to get command-line utility qemu-img (Qemu disk image utility).
These disk images are used to emulate disk storage devices. Disk images are virtual hard disks which are used with virtual machines. In this article, we would focus on how to convert disk images to various formats using command-line utility qemu-img in Ubuntu distribution.