Ubuntu using Ramdisk for better performance and fast response

来源:互联网 发布:树莓派和单片机的区别 编辑:程序博客网 时间:2024/06/05 18:51

原文连接Ubuntu using Ramdisk for better performance and fast response

I have written a tutorial about speed up Ubuntu response time by optimizing the usage of swap area, and that’s avoiding swapping processes out of physical memory for as long as possible. Here’s another way usingramdiskto get better performance and fast response for Ubuntu.

Ramdisk is part of system memory. Ubuntu by default uses a half of physical memory (RAM) as ramdisk, and it is mounted onto/dev/shm, it can be used just like normal disk space (create files and folders and manipulate them with better performance rather if they were stored on the hard disk). If ramdisk uses more than a half of RAM, data will be moved into the swap space. If ramdisk uses less, the remaining can still do what RAM’s doing.

Set upper limit of ramdisk

As is said above, ramdisk by default can use a half of RAM. If you want to change the upper limit, follow the steps below:

1. Edit /etc/fstab by your favourate editor:

gksudo gedit /etc/fstab

2. Find this line and change to make it looks like this(add this line if not exist, and change 512M to what you like.):

tmpfs /dev/shm tmpfs defaults,size=512M 0 0

3. Reboot or re-mount/dev/shm.

Mount /tmp onto ramdisk

To make it easy to use, you can mount a directory into/dev/shmby following commands:

mkdir /dev/shm/tmpchmod 1777 /dev/shm/tmpmount --bind /dev/shm/tmp /tmp

0 0
原创粉丝点击