Loading persistent USB Flash to RAM

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Frappe
Level 1
Level 1
Posts: 32
Joined: Sat Mar 22, 2014 10:44 am

Loading persistent USB Flash to RAM

Post by Frappe »

I have wanted to carry around my own portable linux mint while travelling and decided to make a persistent bootable linux mint (32-bit) xfce. I have done that, tested it on 2 computers and it does remember all my settings. I will mainly use it for browsing only (syncing google chrome etc)

It's just the way I want it, however It pauses for like 2 seconds every 30secs to 1 minute. I know because it's continually referring to the flash drive.

What I want to do is instead boot into ram, anyone have the steps how? Most PC's I know have the capacity to run it from Ram only and I think it's going to be much snappier and cause less wear and tear on the flash drive.
I don't care if I lose the peristence by doing so as I already have customised it.

I just want to be able to boot up into ram with the current settings I now have. Possible?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Mute Ant

Re: Loading persistent USB Flash to RAM

Post by Mute Ant »

The command man casper will show you what the Live Session system can do. Specifically the kernel boot argument toram if you are booting an unmodified ISO or toram=filesystem.squashfs if the ISO has been unpacked into a larger space. The machine will need to have at least 4GiB RAM for a toram booted Mint to work without problems. Half the RAM is used as OS workspace, plus the size of the ISO.

A toram boot which includes your changes to the OS would need a respin of the ISO. That's possible, but Mint has no automated tools for this. You make a new version of the file /casper/filesystem.squashfs based on your modified OS and 'slipstream' it into a distribution ISO to replace the original. Not simple.

Stuttering because the store can't write fast enough is just Poo-Stick Syndrome, cured by using a USB3 store. Even if the connection is only USB2 the 2017 I-Can-Do-Video-Recording chips are faster at writing than the 2015 I-Can-Store-Your-Music chips...

USB3 Tiger Stick: 15MB/s sustained write speed: SanDisk Ultra 16GB
Image
USB2 Poo Stick: 3MB/s sustained write speed: SanDisk Cruzer 16GB
Last edited by Mute Ant on Sat Feb 24, 2018 12:56 pm, edited 3 times in total.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Loading persistent USB Flash to RAM

Post by pbear »

In my understanding, mkUSB has a boot option to load in RAM for this very reason, although I've never tested it. What I have tested it persistence over 4 GB and I wrote up how I did the installation here, with links to more information.

You might be able to get to the same place by editing the boot options of your present drive, but I don't know how.
Frappe
Level 1
Level 1
Posts: 32
Joined: Sat Mar 22, 2014 10:44 am

Re: Loading persistent USB Flash to RAM

Post by Frappe »

Thanks for the replies.

How do I make my current configuration an ISO so that I can use that as the source for the mkusb tool 'persistent live'
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Loading persistent USB Flash to RAM

Post by pbear »

I don't know whether such a thing is possible. Frankly, I assumed you'd just redo the installation, which is what I'd do.

Meanwhile, I've had a chance to look at what mkUSB does to implement boot-to-ram (I have such a drive for my external Timeshift repair kit) and it's as simple as adding toram to the boot parameters. I'm not enough of a power user to guide you through doing the same thing with your drive, but maybe someone else can. To help them help you, boot the drive, hit "e" (for edit), copy down verbatim the current command string and post it here.

BTW, my experience with flash drives has been as Mute Ant says. Even on a 2.0 port, 3.0 drives run MUCH faster than a 2.0. On reflection, that change probably would do more for your situation than worrying about boot-to-ram.
Mute Ant

Re: Loading persistent USB Flash to RAM

Post by Mute Ant »

I think it's worth mentioning that a Live Session and an installed OS do all the real work in RAM anyway. The CPU simply has no way to address a block device except by reading the blocks into RAM first. So any lumpiness in the OS is almost certainly caused by a stack of persistent changes queued up, waiting to be written -----> Needs a faster persistent store.

When I said a respin of a distribution is 'not simple' I meant there's no single path to get what you want, no step-by-step-always-works method. 'How can I include my changes in an ISO' is like 'How can I win a game of chess', you get lots of hints but no single answer except the one you invent for yourself.

o The number-one package is squashfs-tools which provides the equivalent of unzip and zip for a squashed OS.

o If you start with a Live Session Mint using an unpacked ISO, the files are visible and can be modified.

o The unmodified OS which you intend to replace is the /cdrom/casper/filesystem.squashfs file.

o The unsquashed contents of that file are visible under the /rofs folder.

o You can mount modified versions of OS folders on-top-of the /rofs originals.
oo mount -o bind /var /rofs/var
oo mount -o bind /usr /rofs/usr

o You can make a new squashfs. It takes many many minutes to make a zipped version of the whole OS.
oo mksquashfs /rofs /folder/with/enough/free/storage/filesystem.squashfs

o You can replace the original squashfs with your version. The old version will stay mounted but renamed until you reboot.
oo mount -o remount,rw /cdrom
oo mv /cdrom/casper/filesystem.squashfs /cdrom/casper/filesystem.squashfs-$$
oo cp /folder/with/enough/free/storage/filesystem.squashfs /cdrom/casper/

Manual operation all the way. Not simple ###eof###
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Loading persistent USB Flash to RAM

Post by pbear »

Mute Ant wrote: Sun Feb 25, 2018 10:53 amNeeds a faster persistent store.
Suppose Frappe wants to take the advice to use a 3.0 flash drive. What would be the simplest way to copy his current drive onto the new one? I suspect the answer is dd. If so, what would be the exact command string?
Mute Ant

Re: Loading persistent USB Flash to RAM

Post by Mute Ant »

"persistent bootable linux mint (32-bit) xfce" ...is too fluffy for me to guess the details. A safe-and-GUI way is to make an image of the USB stick as a file, first, with the Disks accessory. Then USB Image Writer to write it out to a new store. That rather assumes some other Mint OS to do the work though, with enough storage to hold a whole USB store.
Frappe
Level 1
Level 1
Posts: 32
Joined: Sat Mar 22, 2014 10:44 am

Re: Loading persistent USB Flash to RAM

Post by Frappe »

pbear wrote: Sun Feb 25, 2018 1:23 pm
Mute Ant wrote: Sun Feb 25, 2018 10:53 amNeeds a faster persistent store.
Suppose Frappe wants to take the advice to use a 3.0 flash drive. What would be the simplest way to copy his current drive onto the new one? I suspect the answer is dd. If so, what would be the exact command string?
I already am using a USB 3.0 stick 100mbs read write speed... hardly seems worth it with the consistent pausing. All I want to do I fire up a live USB that remembers my networking details, a synced chromium, and youtube... not too must ask for I wouldn't have thought.

The other recommendations seem like a bit of a headache to be honest.

I used the systemback utility which created an ISO of my current configuration. No errors in the creation of this Live USB, but simply didn't boot into the machine that it was created from. Weird.
Mute Ant

Re: Loading persistent USB Flash to RAM

Post by Mute Ant »

"All I want to..." If you trust in yourself... and believe in your dreams... and follow your star... you'll still get beaten by people who spent their time working hard and learning things.
Frappe
Level 1
Level 1
Posts: 32
Joined: Sat Mar 22, 2014 10:44 am

Re: Loading persistent USB Flash to RAM

Post by Frappe »

Mute Ant wrote: Mon Feb 26, 2018 8:43 am "All I want to..." If you trust in yourself... and believe in your dreams... and follow your star... you'll still get beaten by people who spent their time working hard and learning things.
Appreciate the help, but you know following instructions found online which no longer work what are you supposed to do? I have tried quite a few things, probably with old redundant information.

If you are not going to help and post something constructive, don't reply. That's just plain rude.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Loading persistent USB Flash to RAM

Post by pbear »

He did post something constructive, explaining why something you think should be simple isn't. Your response to that was rude, IMHO. Indeed, my personal reaction was to conclude it wasn't worth trying to help you any further.
Frappe
Level 1
Level 1
Posts: 32
Joined: Sat Mar 22, 2014 10:44 am

Re: Loading persistent USB Flash to RAM

Post by Frappe »

pbear wrote: Mon Feb 26, 2018 10:24 pm He did post something constructive, explaining why something you think should be simple isn't. Your response to that was rude, IMHO. Indeed, my personal reaction was to conclude it wasn't worth trying to help you any further.
I was last advised to use USB 3.0. I responded that I already was. ie a faster persistent storage device.
All I got in return was a fairy tale.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Loading persistent USB Flash to RAM

Post by pbear »

Disingenuous much?
Locked

Return to “Installation & Boot”