`
oliver_peng
  • 浏览: 44266 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Copy file without using cached memory

阅读更多
By default, Linux always cache the file which you just copied. But sometimes you don't want Linux to keep file pages in memory, for example when you copy a big disk image file and never use it again.

To copy file without using cache memory, you can use dd command and here is the sample:

dd iflag=direct,nonblock if=b_1_GB_file bs=64k oflag=direct,nonblock of=b_1_GB_file.backup

In fact, dd command create a pipe between file b_1_GB_file and b_1_GB_file.backup and dump all data from file b_1_GB_file to b_1_GB_file.backup.

Recently I have a problem is that MySQL can't start after I backup the big InnoDB database file to another directory. Here is the error message:

090603 16:10:08  InnoDB: Error: cannot allocate 2147500032 bytes of
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 23965696 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
InnoDB: On FreeBSD check you have compiled the OS with
InnoDB: a big enough maximum process size.
InnoDB: Note that in most 32-bit computers the process
InnoDB: memory space is limited to 2 GB or 4 GB.
InnoDB: We keep retrying the allocation for 60 seconds...
InnoDB: Fatal error: cannot allocate the memory for the buffer pool

Here is the memory status:

free -m
             total       used       free     shared    buffers     cached
Mem:          3287       3140        146          0          4       3013
-/+ buffers/cache:        122       3165
Swap:         4094          0       4094

So at that time, Linux is using 3G memory for cache and reject MySQL's request for allocating 2G memory. Of course, this is a bug. To work around this, you can run following command to release cached memory manually:

sync; echo 3 > /proc/sys/vm/drop_caches
分享到:
评论

相关推荐

    Fast Priority Queues for Cached Memory.

    Fast Priority Queues for Cached Memory.

    WAS OOM异常宕机

    WAS OOM异常宕机原因分析,websphere生成转存储文件

    Cache Memory

    ### Cache Memory:深入理解计算机内存层次中的缓存技术 #### Cache基础知识 缓存(Cache)在计算机科学领域中,指的是为了提高数据访问速度而设计的一种快速存储器。它位于CPU与主内存之间,用于存储频繁访问的...

    lmbench-一个benchmark for linux

    o Cached file read o Memory copy (bcopy) o Memory read o Memory write o Pipe o TCP * Latency benchmarks o Context switching. o Networking: connection establishment, pipe, TCP, UDP, and RPC ...

    scikit-learn-1.0.2.tar.gz

    Scikit-learn是一个广泛使用的Python库,专门用于执行各种机器学习和数据分析任务。1.0.2是这个库的一个特定版本,它包含了自上次更新以来的一系列改进、修复和新特性。在本篇文章中,我们将深入探讨scikit-learn ...

    webrtcvad-2.0.10.tar.gz

    图像特征检测算法-SIFT的Python实现,下载的文件为vlfeat-0.9.20-bin.tar.gz,解压缩后,将vlfeat-0.9.20/bin/win64文件夹下的sift.exe和vl.dll拷贝到当前工作目录下。

    scikit_learn-1.1.1-cp311-cp311-win_amd64.whl

    scikit_learn-1.1.1-cp311-cp311-win_amd64.whl

    bitarray-2.2.5-cp38-cp38-win32

    bitarray-2.2.5-cp38-cp38-win32

    tensorflow-1.4.0-cp36-cp36m-win_amd64 AVX2

    TensorFlow是Google开发的一款强大的开源库,用于数值计算和机器学习任务,尤其在深度学习领域广泛应用。本资源是TensorFlow的CPU版本,适用于Python 3.6环境,并且经过优化,支持AVX2指令集,这将使得在执行计算时...

    Python库 | pytest_flask-0.15.1-py2.py3-none-any.whl

    资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:pytest_flask-0.15.1-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    tensorflow-gpu-2.10.1-cp310-cp310-linux.whl

    该资源为tensorflow_gpu-2.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl,欢迎下载使用哦!

    Python库 | tensorflow_io-0.23.0-cp39-cp39-win_amd64.whl

    python库。资源全名:tensorflow_io-0.23.0-cp39-cp39-win_amd64.whl

    Python库 | useragents-0.1-py3-none-any.whl

    在IT行业中,Python是一种广泛应用的高级编程语言,以其简洁、易读的语法和丰富的库生态而备受推崇。本文将深入探讨“useragents-0.1-py3-none-any.whl”这一Python库,以及它在Python开发中的作用。...

    Python库 | leveldb-0.20.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:leveldb-0.20.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    feedparser-5.2.1

    《Feedparser-5.2.1:解析RSS与Atom feed的利器》 在信息技术日新月异的时代,数据的获取和处理变得至关重要。其中,RSS(Really Simple Syndication)和Atom是两种广泛使用的Web内容发布格式,它们允许用户订阅并...

    安装包feedparser-5.2.1

    在Python编程语言中,`feedparser`是一个非常实用的库,专门用于解析RSS(Really Simple Syndication)和Atom等Web feeds。标题中的“feedparser-5.2.1”指的是这个库的一个特定版本,即5.2.1。...

    pyWinhook-1.6.2-cp38-cp38-win_amd64

    pyWinhook-1.6.2-cp38-cp38-win_amd64

    MemoryLeaks:内存泄漏的常见情况和使用MLeaksFinder的检测

    一 、背景 平常我们都会用 Instrument 的 Leaks / Allocations 或其他一些开源库进行内存泄露的排查,但是检查过程非常繁琐,而且不清晰,最主要的是Abandoned memory不会被检测出来。...Cached memory: Memory s

    opencv_python-4.1.0-cp37-cp37m-win_amd64.whl

    opencv_python-4.1.0-cp37-cp37m-win_amd64.whl

    sklearn-0.0.tar.gz

    sklearn-0.0.tar.gz

Global site tag (gtag.js) - Google Analytics