How can I use SSD disk space as RAM to run large-memory jobs on the Raspberry Pi? Is this the same in Linux as creating "ramdisk" as per this Q&A?
I assume you mean SD instead of SSD? Creating an Swap partition on the SD card should work as a kind of RAM for the drive.
If you mean SSD there is no true way of connecting an SSD drive to the Pi in the first place. If you are connecting by USB there will be no big increase, not even an normal HDD attached externally can run at full speed.
This is not possible.
The memory for the Raspberry Pi is fixed on the board and there is no interface to extend it or replace it.
I think the confusion comes from the fact that SSD (Solid State Disk) is using memory chips to store the data. But that's where the similarities end. The memory chips on the SSD are very much different than normal RAM. It is not possible to replace one for the other.
The SSD has a SATA disk interface. The RAM has a memory bus interface. They are so different, that the best analogy I can offer is like comparing a gas cooking oven to a microwave.
I tried to simplify the information that follows, so for anyone reading this with deeper understanding, please bear in mind this is only a very high level summary:
The SSD chips are Flash Memory and have a non-volatile storage ability, similar to the USB thumb disks. This means they can retain their data even without power. They also need a special controller chip to talk to them. This chip is connected to a SATA disk interface and follows the SATA protocol. In my analogy, the SSD is the gas cooking oven and the SATA bus is the gas supply to the house.
The typical RAM chips are known as DRAM, i.e. Dynamic RAM (also known as DDR SDRAM, etc). They store data for a very short time, which makes it necessary to take them off-line (disconnect these chips from the rest of the circuits) to refresh their stored data. This happens several hundreds or thousands of times per second and it is transparent to the user. If the power goes off then this refresh stops and their data are lost for ever. Dynamic RAM chips follow a completely different protocol from Flash Memory chips and they connect to a Dynamic Memory Controller, who in turn, connects to a very high speed memory bus. This memory bus goes directly into the heart of the CPU chip. In my analogy the Dynamic RAM is the microwave oven and the high speed memory bus is the electricity mains supply.
The Rapsberry Pi CPU has a special connection for the RAM and nothing but Dynamic RAM can connect there. SATA and USB connections are kept separately.
So although they both do the same job (SSD and RAM store code and data, gas cookers and microwaves cook food and warm up meals) they do this job in completely different and incompatible ways. One can not be substituted for the other.
Finally, the RAM Disk is a trick of the operating system that pretends that some of the available RAM is actually a storage disk. This reduces the available RAM as very correctly lenik points out in his reply.
Adding swap to the Raspberry Pi
You can either use a swap file, or a swap partition. If you decide to use a swap partition, be sure you read carefully, as you do not want ruin any important data.
Creating swap file
dd if=/dev/zero of=/SWAPFILE bs=1024 count=524288
- This will create a 512MB blank file.
- Change the count= to your preferred size.
chown root:root /SWAPFILE
chmod 0600 /SWAPFILE
Creating swap partition
dd if=/dev/zero of=/dev/sdXN bs=1024
- This will fill the entire partition of /dev/sdXN
Persistent at boot (add to /etc/fstab)
- Add either:
- /SWAPFILE swap swap defaults 0 0
- /dev/sdXN swap swap defaults 0 0
Test if it's active
RAM disk is totally opposite of what you want to do. it creates disk in the RAM, when you need extra speed and don't care about the memory.
using SSD as RAM... dunno, maybe create swap partition on SSD and let it swap there.
protected by goldilocks♦ Oct 8 '15 at 10:12
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?