IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Linux:vi的时候出现【E297: Write error in swap file】

    Adamhuan发表于 2017-03-01 02:55:48
    love 0

    大概的报错如题所示,更详细的内容如下:

    文本:

    E297: Write error in swap file
    E303: Unable to open swap file for "xxxxx", recovery impossible

    然后,画面会变成:

    E297: Write error in swap file
    "/etc/hosts" 11L, 264C
    Press ENTER or type command to continue

    其实,回车后就可以编辑了;但是,肯定是有问题的。

    虽然可以编辑,但是无法保存:

    "/etc/hosts"
    "/etc/hosts" E514: write error (file system full?)
    "/etc/hosts"
    "/etc/hosts" E514: write error (file system full?)
    Press ENTER or type command to continue

    如果你做过编辑,但无法保存,那么退出的时候要强制退出(:q!),否则会出现这样的错误:

    E37: No write since last change (add ! to override)

    查看SWAP的使用情况:

    [root@mha1 ~]# swapon -s
    Filename                                Type            Size    Used    Priority
    /dev/dm-1                               partition       8232952 0       -1
    [root@mha1 ~]# 
    [root@mha1 ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:         16077      15886        190          0        155       4403
    -/+ buffers/cache:      11328       4749
    Swap:         8039          0       8039
    [root@mha1 ~]#

    查看文件系统的使用情况:

    [root@mha1 ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_mha1-lv_root
                           42G   42G     0 100% /
    tmpfs                 7.9G   88K  7.9G   1% /dev/shm
    /dev/sda1             485M   37M  423M   8% /boot
    [root@mha1 ~]#

    可以看到,出问题的原因是:根分区满。

    清理好了之后,就可以恢复了。
    ——————————
    Done。



沪ICP备19023445号-2号
友情链接