4

In Ubuntu, one can boot a live USB fully to ram using toram option. adding toram option

However this procedure is GUI based. Is there anyway to just write down the toram option to the ISO file so that the bootable USB directly boots from RAM?

The GUI based way to boot Ubuntu from RAM is described here.

Edit: All of the mentioned and proposed idea works. Although, I accepted one solution, One can try any of those methods according to their necessity.

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
Tokai
  • 43
  • Hi..this question may have the answer as one of the point in the below link.. – PRATAP Aug 21 '20 at 09:56
  • https://askubuntu.com/q/1175819/739431 point No.5 in the answer.. – PRATAP Aug 21 '20 at 09:57
  • If you create a persistent live USB boot drive with the tool mkusb, you will find an option, that lets you boot 'live-only to RAM'. You can easily edit the grub.cfg file (in partition #3 of the USB boot drive) to move this menuentry to the top (or even remove the other menuentries). – sudodus Aug 21 '20 at 11:19
  • If you are booting an ISO file,you are likely using GRUB2. You can add toram to the linux line of grub.cfg. right after quiet splash or at the end, one space after -- will work. I will add a proper answer as soon as I have time. – C.S.Cameron Aug 21 '20 at 11:44
  • In the end I want to install the custom device on multiple machines and automatically boot from ram. @sudodus I know what is persistent live USB. But the next part , I did not get. But I think that is machine dependent, every time I have to go through the same procedure? @C.S.Cameron so you are suggesting that I can edit the gurb add the toram option ? IS the machine dependent too ? for every new machine I have to go through the same procedure ? – Tokai Aug 21 '20 at 11:53
  • @Tokai, You can create one persistent live drive in a USB pendrive (with or without edits to grub.cfg), and then you can clone it to other USB pendrives or internal drives for the machines that you want to boot toram. – sudodus Aug 21 '20 at 12:09
  • @Tokai, If C.S.Cameron has the time, and you want it, he might write a step-wise description of a 'grub-n-iso' or 'isoboot' method to get what you want, something like this link but focusing on toram. – sudodus Aug 21 '20 at 12:15
  • 1
    @sudodus I got the C.S. Cameron's idea. It seems the solution link provided by UnKnown and C.S. Cameron and you , point almost in same direction. Cubic provides a gui in where a menuentry provided by Cameron has to be pasted. Which edits the grub.cfg file you mentioned. I just read a bit and now understand better :) I am trying out all the the ideas for learning. Thanks for your kind notes. I will update the answer after I finish playing with these methods. – Tokai Aug 21 '20 at 12:38
  • Good luck @Tokai :-) – sudodus Aug 21 '20 at 12:43

1 Answers1

4

Booting ISO file toram

If you are booting an ISO file,you are likely using GRUB2. You can add toram to the linux line of grub.cfg. right after quiet splash or at the end, one space after --

Boot ISO menuentry may look like:

menuentry "Ubuntu 20.04 ISO" {
    rmmod tpm
    set root=(hd0,1)
    set isofile="/isos/ubuntu-20.04-desktop-amd64.iso"
        loopback loop $isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile persistent persistent-path=/ub2004-1/ fsck.mode=skip quiet splash toram -- 
        initrd (loop)/casper/initrd
}

More on booting ISO files using a simple BIOS/UEFI template image here: BIOS/UEFI Template Image for Booting ISO Files

C.S.Cameron
  • 19,519
  • @Tokai, This works provided that the file system is read/write :-) This is why I suggested a persistent live drive by mkusb, or a 'grub-n-iso' alias 'isoboot' method. (In standard (cloned directly from the iso file) USB boot drives, there is a iso9660 file system which is read-only.) – sudodus Aug 21 '20 at 12:29
  • @Tokai: I should mention that sudodus has been working on a Template image for booting ISO files in BIOS and in UEFI modes. It can be installed to a USB from Windows using Rufus or Etcher. It can be installed in Linux using mkusb and Disks. once flashed just add an ISO, or a few, and update grub.cfg if necessary. See: https://ubuntuforums.org/showthread.php?t=1958073&page=100&p=13979560#post13979560 for more details. – C.S.Cameron Aug 21 '20 at 13:11