Out of inodes: различия между версиями

Материал из Bas Wiki
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
 
(не показана 1 промежуточная версия этого же участника)
Строка 2: Строка 2:
<br />
<br />
Почему так? Смотрим <code>man newfs</code>:
Почему так? Смотрим <code>man newfs</code>:
<source lang="text">-f frag-size
<pre>
-f frag-size
             The fragment size of the file system in bytes.  It must be a
             The fragment size of the file system in bytes.  It must be a
             power of two ranging in value between blocksize/8 and blocksize.
             power of two ranging in value between blocksize/8 and blocksize.
Строка 13: Строка 14:
             create more inodes a smaller number should be given.  One inode
             create more inodes a smaller number should be given.  One inode
             is required for each distinct file, so this value effectively
             is required for each distinct file, so this value effectively
             specifies the average file size on the file system.</source>
             specifies the average file size on the file system.
</pre>
Если кратко, то:
Если кратко, то:
* размер фрагмента (frag-size) по умолчанию 4096 байт
* размер фрагмента (frag-size) по умолчанию 4096 байт
Строка 26: Строка 28:
[[Category:File System]]
[[Category:File System]]
[[Category:FreeBSD]]
[[Category:FreeBSD]]
[[Category:inode]]
[[Category:newfs]]

Текущая версия от 23:07, 25 февраля 2018

Создал установку FreeBSD с очень ограниченным количеством места. Получилось так, что дерево портов по команде portsnap extract не помещалось на раздел в 2 ГБ, хотя по факту оно занимает менее 1 ГБ. В логах можно увидеть ошибку "out of inodes".

Почему так? Смотрим man newfs:

-f frag-size
             The fragment size of the file system in bytes.  It must be a
             power of two ranging in value between blocksize/8 and blocksize.
             The default is 4096 bytes.

-i bytes
             Specify the density of inodes in the file system.  The default is
             to create an inode for every (4 * frag-size) bytes of data space.
             If fewer inodes are desired, a larger number should be used; to
             create more inodes a smaller number should be given.  One inode
             is required for each distinct file, so this value effectively
             specifies the average file size on the file system.

Если кратко, то:

  • размер фрагмента (frag-size) по умолчанию 4096 байт
  • каждая inode создаётся для (4 * frag-size) байт, т.е. в нашем случае для (4 * 4096) или 16384 байт


По этой причине нам может не хватить количества inode на маленьких раздела, даже не смотря на то, что место есть. Особенно это актуально, если у вас много мелких файлов (в моём случае - дерево портов). Для решения этой проблемы необходимо пересоздать раздел, уменьшив количество байт, выделяемых под inode.

ВНИМАНИЕ! Данные необходимо сохранить перед пересозданием раздела, иначе они будут потеряны! Сохранив данные пишем:

# newfs -O 2 -i 1024 /dev/da1p1

..., и радуемся новому разделу с большим количеством inode :)