天天看点

inode 引起的No space left on device

1、现象

cp: cannot create directory `/mnt/usr/portage/app-emacs/h4x0r': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/csv-mode': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/ess': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/mew': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/org-mode': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/vhdl-mode': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/tdtd': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/dired-sort-menu': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/uboat': No space left on device

cp: cannot create directory `/mnt/usr/portage/app-emacs/mode-compile': No space left on device

2、分析

df -i : 查看文件系统的inodes节点数

[email protected]:/extFlash1/rootfs/gentoo# df -i

Filesystem           Inodes  IUsed  IFree IUse% Mounted on

/dev/sda2           1179648 210218 969430   18% /

udev                 124795    532 124263    1% /dev

tmpfs                126991    455 126536    1% /run

none                 126991      6 126985    1% /run/lock

none                 126991      1 126990    1% /run/shm

/dev/sda5             24096    231  23865    1% /boot

/dev/sdb1            655360 317560 337800   49% /extFlash1

/dev/mapper/loop0p2  222656 222656      0  100% /mnt

由于文件系统所对应的inode已经全部使用,最终无法给后续复制的文件分配inode。

3、解决方法

重新格式化/dev/mapper/loop0p2,并指定inode数,如下:

mkfs.ext4 /dev/mapper/loop0p2  -N 235000 (inode 数根据实际情况估计)

继续阅读