How to create a persistent live on a file (disk image)?
I created a personnalized ubuntustudio iso with cubic (it is smaller than the official).
And i would like to write a persistent live in a file less than 4G (audio-ubuntustudio.img)
In order to be able to clone the disk image to USB keys using dd or rufus.exe even if they are greater than 4GB.
I've tried with mkusb but it doesn't want to write to disk image.
Do you know an mkusb option or another tool to do that ?
61 Answer
Install virtualbox:
sudo apt install virtualboxStart by creating a file of the desired size:
fallocate -l 3900M my-virtual-usb-stick.imgstart virtualbox:
sudo virtualboxCreate a virtual machine with a virtual disk on which you will install Linux and mkusb using the graphical interface. Or start an iso image with mkusb built-in.
Attach (with virtualbox GUI) to that virtual machine a usb storage disk my-virtual-usb-stick.vmdk created with the following command in a terminal (CTRL+ALT+t):
sudo VBoxManage internalcommands createrawvmdk \ -filename ./my-virtual-usb-stick.vmdk \ -rawdisk ./my-virtual-usb-stick.imgthen Start the virtual machine, download the Linux iso file and use mkusb with the virtual usb drive.
Once done, stop the virtual machine and quit virtualbox.
Then you can dd your image to a real usb stick (Replace the X with your drive letter):
dd if=./my-virtual-usb-stick.img of=/dev/sdX bs=4M status=progressReboot with your usb stick, and it works !
2