通过挂载的方式在原有目录或新建目录改造
如:
[root@luozhonghua /]# df -h
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_luozhonghua-lv_root 21G 4.1G 16G 21% / tmpfs 4.0K 4.0K 0 100% /dev/shm /dev/sda1 485M 32M 428M 7% /boot tmpfs 4.0K 4.0K 0 100% /dev/shm修改:
[root@luozhonghua /]# mkdir /mnt/ram
[root@luozhonghua /]# mount -t tmpfs -o size=1024m tmpfs /mnt/ram
[root@luozhonghua /]# df -h
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_luozhonghua-lv_root 21G 4.1G 16G 21% / tmpfs 4.0K 4.0K 0 100% /dev/shm /dev/sda1 485M 32M 428M 7% /boot tmpfs 4.0K 4.0K 0 100% /dev/shmtmpfs 1.0G 0 1.0G 0% /mnt/ram
注意:以上都是临时的,一旦重启linux就还原了,因此永久性的修改原配置如下:
[root@luozhonghua ~]# vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=20G 0 0