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?

  • 4
    Short answer is: It is not possible! You can use it as a swap disk or keep temp files on there but you cannot extend your RAM using the drive. It is just not possible.
    – Piotr Kula
    May 28, 2013 at 12:27
  • 3
    Try using GParted to format your SSD with a linux-swap partition, then run sudo swapon /dev/sda1 (or whatever the swap partition is.) Ramdisk uses your RAM as storage, swap space is basically the opposite - use storage as RAM. May 29, 2013 at 0:05

4 Answers 4


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.

  • 1
    What about when Windows (Ready Boost) allows you to use Flash Drives as extra RAM, could that work? Or is it like trying to add SWAP which won't make the difference hoped for in performance?
    – rhymsy
    Oct 26, 2018 at 18:55
  • ReadyBoost on Windows doesn’t work as RAM, see Wikipedia: en.wikipedia.org/wiki/ReadyBoost . In summary: ReadyBoost is a disk caching solution to speed up slower disks. Typically this involves copying data from spinning disks to flash drives to reduce data access times. Nov 3, 2019 at 7:34

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
  • mkswap /SWAPFILE
  • swapon /SWAPFILE

Creating swap partition

  • dd if=/dev/zero of=/dev/sdXN bs=1024
    • This will fill the entire partition of /dev/sdXN
  • mkswap /dev/sdXN
  • swapon /dev/sdXN

Persistent at boot (add to /etc/fstab)

  • vim /etc/fstab
  • Add either:
    • /SWAPFILE swap swap defaults 0 0
    • /dev/sdXN swap swap defaults 0 0

Test if it's active

  • free -m
  • 1
    While SSDs are fast and might be good for swap space, be warned that data can only be written to them a limited number of times.
    – earthmeLon
    May 29, 2013 at 0:04
  • Don't forget you are throttled through the USB2 interface, so the SSD will be less than 10% of it's native speed. I really don't think you need to worry about wearing the flash out by accident. May 29, 2013 at 0:32

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.