dram/README.md

2.4 KiB

Decentralized Remotely Accessed Memory

Ever joked about downloading more RAM? 🤣 WELL NOW YOU CAN MOTHER FUCKER!

Here's the deal: we use a tmpfs on the donor machine to pretend a chunk of its RAM is a hard drive. Then, we get fancy with NFS to share this faux-drive over the network 🌐. On the recipient's side, we mount this networked RAM-drive and set up a swap file.

Go insane with it & donate RAM from multiple machines...decentralize the RAM of a single server all over the planet! Latency is the devil 😈 LOL

The make-it-happen Magic

Setup RAM Donator

  1. Create an entry in /etc/fstab to create the RAM partition:

tmpfs /mnt/ramote_send tmpfs nodev,nosuid,noexec,nodiratime,size=1G 0 0

Note: Change 1G to the amount of RAM you want to donate.

  1. Create the RAM partition directory & mount it:
mkdir -p /mnt/ramote_send
mount /mnt/ramote_send
  1. Download & install an NFS server daemon of your choice:
apt-get install nfs-kernel-server
  1. Configure & start the NFS server:
  • Edit your /etc/exports file:

/mnt/ramote_send <client-ip>(rw,sync,no_root_squash,no_subtree_check)

  • Start & enable the service:
systemctl start nfs-kernel-server
systemctl enable nfs-kernel-server

Setup RAM Receiver

  1. Create a directory & mount the NFS:
mkdir -p /mnt/ramote_recv
mount <nfs-server-ip>:/mnt/ramote_send /mnt/ramote_recv
  1. Create & enable a swap file inside the NFS directory:
dd if=/dev/zero of=/mnt/ramote_recv/swapfile bs=1M count=1024
chmod 600 /mnt/ramote_recv/swapfile
mkswap /mnt/ramote_recv/swapfile
swapon /mnt/ramote_recv/swapfile

Note: Change the swap file size according to what you allocated on the donator.

  1. Create an entry in /etc/fstab to for the NFS mount & the swap file:
<nfs-server-ip>:/mnt/ramote_send /mnt/ramote_recv nfs defaults 0 0
/mnt/ramote_recv/swapfile swap swap defaults 0 0

You can do this across various machines & use multiple swap files for decentralize even more.


Mirrors for this repository: acid.vegasSuperNETsGitHubGitLabCodeberg