I often run into situations where I need to run a live distro in order to do something (say resize the main boot partition). The normal process for this would be to find a usb drive I'm not using for something else, create a live usb from it, then boot to it. The issue is often times in the "find a usb I'm not using for something else". I was think recently and was wondering if maybe there's a way to boot a live distro without the usb. I know you can use the toram kernal option to run entirely in the RAM. This makes me wonder if it would be possible to use some GRUB magic to boot the system directly from RAM without needing use a usb.
- 780
1 Answers
I have a menuentry in my /etc/grub.d/40_custom file that I activate via sudo update-grub to boot into a Lubuntu iso file.
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Lubuntu 18.04.1 Desktop iso" {
set isofile="/lubuntu-18.04.1-desktop-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd.lz
}
This works as expected, but even when I pushed it into RAM with the boot option toram (at the end of the 'linux' line), it would not let me unmount the partition, where the iso file is stored, mounted at /isodevice.
I store the iso file in the root partition of my installed system, so it means that I cannot modify or repair it with tools that only work, when the target partition is unmounted.
It is possible to store the iso file in a separate partition, that is not used by the installed operating system. That way you can use the live system booted from the iso file to edit the partition(s) of your installed operating system.
So modify
(hd0,1)inloopback loop (hd0,1)$isofileto point to that separate partition.
If there is a swap partition in the internal drive and you want to edit it, you must swap it off
sudo swapoff /dev/sdxn
where x is the device letter and n is the partition number
- 47,684