Page 1 of 1

Creating a RAM Disk with Temporay Persistence in RAM-Only Mode?

Posted: Sat Sep 17, 2022 9:45 pm
by Neo_78

"A RAM drive (also called a RAM disk) is a block of random-access memory (primary storage or volatile memory) that a computer's software is treating as if the memory were a disk drive (secondary storage). It is sometimes referred to as a virtual RAM drive or software RAM drive to distinguish it from a hardware RAM drive that uses separate hardware containing RAM, which is a type of battery-backed solid-state drive." (Source: Wikipedia)

If you boot FatDog without hard drives in RAM-only mode, it is easy to create a RAM disk in your working memory, for instance of 512 MB:

mkdir /tmp/ramdisk

sudo mount -t tmpfs -o size=512m myramdisk /tmp/ramdisk

mount | tail -n 1

In theory the RAM disk should get deleted from memory when you reboot the system.

Is there a way to make the RAM disk persistent for at least 1 boot cycle although you are operating FatDog in RAM-only mode?


Re: Creating a RAM Disk with Temporay Persistence in RAM-Only Mode?

Posted: Sat Sep 17, 2022 10:00 pm
by step

All I can think of to make RAM data survive a reboot is to save the data to a non-volatile storage media. If your system is diskless but networked, you could connect to a network or cloud drive and save there. If the system is isolated then plug in a USB drive and save there. Saving should be the last action before the system goes down. If you want to automate, add the save commands to /etc/rc.d/rc.local.shutdown.
When the system reboots, you could restore the ram disk by recreating it and copying back the data your saved on shutdown. To automate this step, add your restore commands to /etc/rc.d/rc.local.

Aside: note that /tmp already is a ram disk, so you might not even need to create another ram disk but could just use some /tmp/folder as your volatile container.


Re: Creating a RAM Disk with Temporay Persistence in RAM-Only Mode?

Posted: Sat Sep 17, 2022 10:15 pm
by Neo_78

Is it technically possible to store the save commands that would be required to make the RAM disk persistent in the BIOS chip of the motherboard using something like flashrom?


Re: Creating a RAM Disk with Temporay Persistence in RAM-Only Mode?

Posted: Sun Sep 18, 2022 12:15 pm
by mikewalsh

I have to wonder at the need for an additional RAM disk anyway.

As step quite rightly says, /tmp is essentially a RAM-disk in the first place. Also - as I understand it - FatDog isn't so different to Puppy, in that it runs in RAM for the duration of the session.....so; where's the point?

As for trying to store commands in the BIOS chip with flashrom.....don't even go there. I know it looks a fine & dandy place to put such commands, but this is the heart of the first-stage hardware initialization for any computer. If you get this wrong, you can so easily "brick" your machine. And then, you are completely stuffed.

Don't do it. I speak as one who's used flashrom in the past, albeit under the tutelage of someone more experienced with it than I. If you don't know what you're doing here, for gawd's sake, leave well alone.

Mike. :|


Re: Creating a RAM Disk with Temporay Persistence in RAM-Only Mode?

Posted: Mon Sep 19, 2022 1:48 pm
by p310don

/dev/shm

That's the ram drive on linux systems. It is half of your RAM as a disk.

A ram drive and persistence are basically opposite things. If you want a certain script or task, why not create a remaster of Fatdog with what you need, and then boot without a save file?