1. 执行sync命令
sync
说明:使用sync命令以确保文件系统的完整性,sync 命令运行 sync 子例程,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件。
2. 修改/proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
说明:
Writing to this file causes the kernel to drop clean caches,dentries and inodes from memory, causing that memory to becomefree.
To free pagecache, use echo 1 > /proc/sys/vm/drop_caches;
to free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 >/proc/sys/vm/drop_caches.
Because this is a non-destructive operation and dirty objects are not freeable, the user should run sync first.
sync
说明:使用sync命令以确保文件系统的完整性,sync 命令运行 sync 子例程,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件。
2. 修改/proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
说明:
Writing to this file causes the kernel to drop clean caches,dentries and inodes from memory, causing that memory to becomefree.
To free pagecache, use echo 1 > /proc/sys/vm/drop_caches;
to free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes, use echo 3 >/proc/sys/vm/drop_caches.
Because this is a non-destructive operation and dirty objects are not freeable, the user should run sync first.
本文介绍了两种有效的方法来释放Linux系统的内存缓存,确保文件系统的完整性。首先通过执行sync命令将所有未写入的数据同步到磁盘。其次,通过修改/proc/sys/vm/drop_caches文件来清除不同类型的缓存,包括页面缓存、目录项缓存和inode缓存。
3508

被折叠的 条评论
为什么被折叠?



