window.ENTITIES={'/api/snippets/bash/linux%20%7c%20bash%20-%20create%20and%20mount%20ram%20disk':[{"result":true,"message":null,"batch":{"type":"bash","name":"linux | bash - create and mount ram disk","items":[{"id":"DkPmkp","type":"bash","name":"Linux | Bash - create and mount RAM disk","content":"sudo mount -o size=PUT_SIZE_HERE -t tmpfs none /path/to/mount-directory\n\n\n# Where:\n# `-o size=PUT_SIZE_HERE` indicates RAM disk size in bytes, kilobytes, megabytes or gigabytes, e.g. x, xK, xM or xG,\n# `-t tmpfs` indicates used `tmpfs` as file system (it is very fast),\n# `none` indicates mount device that is not set in this case,\n# `/path/to/mount-directory` indicates place where RAM disk is mount.\n\n\n# Hint: to unmount RAM disk use `sudo umount /path/to/mount-directory` command.\n\n\n\n# ----------------------------------------------------------------------------------------\n# Practical example (10GB RAM disk mount in /mnt/RAM directory):\n# ----------------------------------------------------------------------------------------\n\nsudo mkdir /mnt/RAM\nsudo mount -o size=10G -t tmpfs none /mnt/RAM","source":"","author":{"id":"ZaEQEa","name":"Mark-Rotteveel","avatar":"1629142676006__ZaEQEa__w40px_h40px.jpg","points":537,"role":"BASIC"},"creationTime":1741441923000,"updateTime":1741457075000,"removalTime":null},{"id":"jPlWkj","type":"bash","name":"Linux | Bash - create and mount RAM disk","content":"sudo modprobe brd rd_nr=1 rd_size=PUT_SIZE_HERE\nsudo mkfs.ext4 -q /dev/ram0\nsudo mount /dev/ram0 /path/to/mount-directory\n\n\n# Where:\n# `modprobe` creates `/dev/ram0` block device in the above case,\n# `brd` indicates `block RAM disk` module,\n# `rd_nr=1` indicates number of created block RAM disks, so only `/dev/ram0` disk will be created,\n# `rd_size=PUT_SIZE_HERE` indicates size of created block RAM disk measured in kilobytes,\n# `mkfs.ext4` foramts `/dev/ram0` block device using ext4 file system in the above case,\n# `-q` indicates quick formatting mode,\n# `/dev/ram0` indicates used block device,\n# `mount` mounts `/dev/ram0` block device inside `/path/to/mount-directory` directory in the above case,\n# `/dev/ram0` indicates used block device,\n# `/path/to/mount-directory` indicates place where RAM disk is mount.\n\n\n# Hint: to unmount RAM disk use `sudo umount /path/to/mount-directory` command.\n\n\n\n# ----------------------------------------------------------------------------------------\n# Practical example (10GB RAM disk mount in /mnt/RAM directory):\n# ----------------------------------------------------------------------------------------\n\nsudo modprobe brd rd_nr=1 rd_size=$((10 * 1024 * 1024))\nsudo mkfs.ext4 -q /dev/ram0\nsudo mkdir /mnt/RAM\nsudo mount /dev/ram0 /mnt/RAM","source":"","author":{"id":"lD31Eo","name":"Hiba-Tate","avatar":"1629131291370__lD31Eo__w40px_h40px.jpg","points":548,"role":"BASIC"},"creationTime":1741442748000,"updateTime":1741457086000,"removalTime":null},{"id":"jQ7LQD","type":"bash","name":"Linux | Bash - create and mount RAM disk","content":"# Note: you can use existing tmpfs mount point:\n#\n/dev/shm","source":"","author":{"id":"dDYwEo","name":"Pearl-Hurley","avatar":"1629133461670__dDYwEo__w40px_h40px.jpg","points":559,"role":"BASIC"},"creationTime":1745478664000,"updateTime":1745478670000,"removalTime":null}]}}]};