Có gì mới?
Việt Game - NET

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Lưu ý trước khi đăng ký thành viên.! Đọc kỹ quy định của forum, nếu thành viên thường có thể sử dụng mọi tính năng như chatbox, đăng bài, bình luận được hết. Nhưng một số link đính kèm sẽ bị ẩn, nếu VIP mới thấy.

Vietboot Forum

Chia sẻ Ram Disk Linux

designvb

Thành viên
Tham gia ngày
01/07/2014
Bài viết
92
Reaction score
14
Điểm
10
There are many reasons for creating a memory based file system in Linux, not least of which is to provide a near zero latency and extremely fast area to story files. A prime use of a RAM disk is for application caching directories or work areas.

There are two main types of RAM disk which can be used in Linux and each have their own benefits and weaknesses:

  • ramfs
  • tmpfs
See my other post for the differences between ramfs and tmpfs.

Check the amount of free RAM you have left on your machine before creating a RAM disk. Use the Linux command free to see the unused RAM. The below is an example of a 31GB of ram in a production server.

free -g

total used free shared buffers cached

Mem: 31 29 2 0 0 8

-/+ buffers/cache: 20 11

Swap: 13 6 7

The free command shows the amount of RAM availale on your system in addition to the amount of memory used, free and used for caching. SWAP space is also displayed and shows if your system is writing memory to disk.

Create a folder to use as a mount point for your RAM disk.

1

mkdir /mnt/ramdisk

Then use the mount command to create a RAM disk.

1

mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]

Substitute the following attirbutes for your own values:

  • [TYPE] is the type of RAM disk to use; either tmpfs or ramfs.
  • [SIZE] is the size to use for the file system. Remember that ramfs does not have a physical limit and is specified as a starting size.
  • [FSTYPE] is the type of RAM disk to use; either tmpfs, ramfs, ext4, etc.
Example:

1

mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk

You can add the mount entry into /etc/fstab to make the RAM disk persist over reboots. Remember however, that the data will disappear each time the machine is restarted.

1

vi /etc/fstab

1

tmpfs /mnt/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=1024M 0 0

See my other post for the differences between ramfs and tmpfs.
 
Chỉnh sửa cuối:
có ai vietsub hok ^^
 
10pc shera 4gb dc ko ạ
 
Top Bottom