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

versatile 64-bit multi-user Linux distribution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
Neo_78
Posts: 407
Joined: Wed Dec 29, 2021 10:45 pm
Has thanked: 232 times
Been thanked: 11 times

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

Post 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?

Last edited by Neo_78 on Sat Sep 17, 2022 10:17 pm, edited 1 time in total.
step
Posts: 545
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 56 times
Been thanked: 197 times
Contact:

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

Post 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.

Neo_78
Posts: 407
Joined: Wed Dec 29, 2021 10:45 pm
Has thanked: 232 times
Been thanked: 11 times

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

Post 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?

User avatar
mikewalsh
Moderator
Posts: 6115
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 781 times
Been thanked: 1952 times

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

Post 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. :|

User avatar
p310don
Posts: 356
Joined: Tue Dec 03, 2019 7:17 am
Location: Brisbane, Australia
Has thanked: 72 times
Been thanked: 103 times

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

Post 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?

Post Reply

Return to “FatDog64”