I was very interested in the answer by C.S. Cameron and was keen to try it on some of my machines. The code in that answer did not work for me. The rmmod tpm line generated a non fatal error so I removed it. There is no /casper directory in the GParted iso that I downloaded. However there is a /live directory and I found changing the "casper" entries to "live" was necessary. /live contains vmlinuz and initrd.img. This got me most of the way to success and various searches threw up "toram=filesystem.squashfs" to boot other iso in this manner. Then I found this GParted website link with the following code with a couple of modifications:
menuentry "GParted ISO" {
set root=(hd0,msdos1)
set isofile="/path/gparted.iso"
loopback loop $isofile
linux (loop)/live/vmlinuz boot=live union=overlay username=user components noswap ip=net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}
This works for me on legacy Ubuntu 20.04 and Arch. I haven't tried it on a UEFI/GPT machine which I expect will be different. I found I had to remove "vga=788" from the code because its deprecated. On both machines I placed the iso in my home directory and renamed it to "gparted.iso". The Ubuntu machine has a single partition so the path was /home/user/gparted.iso. The Arch machine has separate / and /home partitions so the path was shorter /user/gparted.iso
One other thing that was vital was to find the correct parameters for root=(hdX,Y). You can find these from the grub menu, just press c for command mode and ls to list the partitions and ls (hdX,Y)/ to list the contents of the top level of that partition which helps with identification. Y will be a number or something like msdos1.
nvme0n1p6
partition is the one where the software is stored that does the actual changing. It would be very dangerous to change that on the fly. – Jos Oct 28 '20 at 10:24