User Tools

Site Tools


ubuntu:disk:ramdisk:create_a_ramdisk

Ubuntu - Disk - Ramdisk - Create a Ramdisk

Create a Ramdisk

mkdir /mnt/ramdisk
mount -t tmpfs -o rw,size=240G tmpfs /mnt/ramdisk

NOTE: This mounts a ramdisk with 240GB under the path /mnt/ramdisk.

  • -t tmpfs:
    • tmpfs only uses memory when you it contains files.
    • When it is empty, it will take almost no space in RAM.
  • An alternative to tmpfs is to use ramfs.
    • tmpfs can use swap as well, whereas ramfs devices are memory only.

Verify the Ramdisk

Verify that the RAMDISK has been created.

df -h

Mount the Ramdisk automatically on system boot

Edit /etc/fstab, and add the following line to the the end of the file.

/etc/fstab
tmpfs  /mnt/ramdisk  tmpfs  rw,size=240G  0   0

ubuntu/disk/ramdisk/create_a_ramdisk.txt · Last modified: 2021/06/22 13:36 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki