91

I have a live USB made with the standard Ubuntu disk image creator for 16.04 LTS. In the current state, I can boot to this disk, but it still requires the original USB to run properly at all times.

Attempting to pull the drive and use the system generates a large amount of I/O errors, further suggesting that the USB drive is actually needed for things not already loaded into RAM (For example, Firefox worked without the USB, but I used it once before already. apt, on the other hand, did not.)

Is there a way to copy the entire Ubuntu live disk to RAM, so I can remove the drive and free up a USB slot for other things?

5
  • 3
    Did you try the "toram" kernel parameter? That will at least speed things up after the boot, not sure if you can remove the USB.
    – ubfan1
    Sep 26, 2016 at 15:36
  • @ubfan1 I have not yet, I can test later today, though.
    – Kaz Wolfe
    Sep 26, 2016 at 15:42
  • On a similar note I want justify a 16gb update when I only use 2 to 3 gb of 8 gb now. If I can through all of Ubuntu into ram (excluding Home) that would be sweet. That 2 second SSD lag would cut down to .25 seconds. Call me spoiled :) Sep 26, 2016 at 17:22
  • 5
    Possible duplicate of Distro that I can load into RAM?
    – LiveWireBT
    Sep 27, 2016 at 22:51
  • Can Ubuntu be installed to the pendrive it was booted from? askubuntu.com/questions/855039/… Oct 8, 2018 at 2:38

1 Answer 1

115

You simply need to add the toram boot parameter in GRUB.

Here is how you can do that, tested (and screenshots taken) with an Ubuntu 16.04 64 bit desktop iso in a VM:

Boot in UEFI mode

Boot from the live DVD/USB and wait for the GRUB menu to appear.

enter image description here

Highlight Try Ubuntu without installing using / and then press E to edit the boot script.

enter image description here

Search for the line starting with linux and add the option toram right after (or instead of) quiet splash, as depicted above. Then press F10 to boot the modified script.

After Ubuntu has fully booted, you may eject/unmount the live DVD/USB device and continue using the system and all available programs.

Boot in BIOS/Legacy mode

Boot from the live DVD/USB and wait for the language selection boot menu to appear.

enter image description here

Select your language with / and confirm with Enter. The boot menu appears.

enter image description here

Use / to highlight Try Ubuntu without installing.

To make the editable Boot Options line appear, press F6 followed by Esc to close the little pop-up.

Then you can navigate the cursor in the Boot Options line using /. Search the quiet splash options and add the toram option after or instead of them, as depicted above.

Boot the modified configuration by simply pressing Enter.

After Ubuntu has fully booted, you may eject/unmount the live DVD/USB device and continue using the system and all available programs.

4
  • 1
    Unfortunately as I confirmed in my recent post, this is NOT how the toram parameter works. It does not in any way allow removing the disk without issues. I'm trying to work through how to do just this here: askubuntu.com/questions/1449132 (Just to note: I'm using 22.04, both with and without persistent enabled. This option may have worked for this purpose previously, but now it does not help)
    – Pecacheu
    Jan 11 at 9:56
  • 1
    @Pecacheu I just used Ubuntu 22.04.2 LTS in a VM and the toram worked perfectly and loaded completely into RAM and I was able to remove the ISO file before it completed loading to the desktop without any errors. So this still works just fine and this answer it still correct.
    – Terrance
    Feb 28 at 1:58
  • 1
    Here's a great tutorial on how to make a persistent live USB using mkusb, and on how to permanently edit the live USB's grub boot menu to add an option to always boot to RAM! See the section at the end titled "Extra: Boot the Live USB to RAM". May 21 at 5:54
  • 1
    Note: I just tested the instructions in this answer on an Ubuntu 22.04 live USB, booted on an old 2015 MacBook with 8 GB RAM, and they worked great! After booting, without loading anything else, the total RAM used was 5.1 GB (62.5% in my case), so be sure to have at least 8 GB of RAM for this to work! In the file manager after fully booting I was then able to right-click the USB and choose to eject it, then I removed it fully and the OS still kept running just fine! May 21 at 5:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.