0

Ideally I need to create a RAM disk just over the lifetime of a python script. That is, the script creates a RAM disk, uses it, and at the end, destroys the RAM disk and gives back its resources to the OS. Is this possible? Or is a reboot required?

I have a rack server that contains over 170 GB of RAM, giving sufficient elbow-room. How quickly can a RAM disk be created on it, and then unmounted and have its resources given back to the OS?

1 Answers1

3

By default /dev/shm is available to all users. Simply write whatever data you want there, and clean up afterwards.

/dev/shm employs tmpfs, which is not pure RAM-disk. If sufficient memory pressure exists it may be written to swap.

You can change the size of it as well.

vidarlo
  • 23,497