第一步:执行sync命令

     使用sync命令以确保文件系统的完整性,sync 命令运行 sync 子例程,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延迟的块 I/O 和读写映射文件


第二步: 修改/proc/sys/vm/drop_caches

    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.