df : no file systems processed 已解决

in linux with 0 comment

在Linux服务器中执行 df -i或者df -h 提示:df : no file systems processed

分析:

在执行df命令时,会读取/etc/mtab文件中的挂载信息,才能获取到当前系统中的分区的挂载情况。/etc/mtab文件是每当            mount挂载分区、umount卸载分区时动态更新的,同时它是与/proc/mount中的挂载信息相同的。

当/etc/mtab中的内容存在异常与/proc/mount不同步时,会导致执行df提示"no file systems processed"。

注:

/etc/mtab文件的作用:
This changes continuously as the file /proc/mount changes. In other words, when filesystems are mounted and unmounted, the change is immediately reflected in this file.

 

解决方案:

通过如下命令让/etc/mtab与/proc/mount内容同步:

        cat /proc/mounts > /etc/mtab

然后就可以使用df -h查询到分区信息了。

[root@localhost home]# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          5.8G  2.9G  2.7G  52% /
devtmpfs        1.9G  184K  1.9G   1% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
/dev/sda2       5.8G  2.9G  2.7G  52% /
/dev/sda1       388M   34M  334M  10% /boot
/dev/sda5       1.8T  146G  1.7T   8% /home
tmpfs           1.9G     0  1.9G   0% /dev/shm

文章转自:https://help.aliyun.com/knowledge_detail/6526066.html

Responses