How many bytes per inodes?

前端 未结 3 977
醉话见心
醉话见心 2021-02-05 03:29

I need to create a very high number of files which are not very large (like 4kb,8kb). It\'s not possible on my computer cause it takes all inodes up to 100% and I cannot create

相关标签:
3条回答
  • 2021-02-05 04:01

    I have found solution to my problem on the mke2fs man page :

    -I inode-size

    Specify the size of each inode in bytes. mke2fs creates 256-byte inodes by default. In kernels after 2.6.10 and some earlier vendor kernels it is possible to utilize inodes larger than 128 bytes to store extended attributes for improved performance. The inode-size value must be a power of 2 larger or equal to 128. The larger the inode-size the more space the inode table will consume, and this reduces the usable space in the filesystem and can also negatively impact performance. Extended attributes stored in large inodes are not visible with older kernels, and such filesystems will not be mountable with 2.4 kernels at all. It is not possible to change this value after the filesystem is created.

    The maximun you will be able to set is given by your block-size.

    sudo tune2fs -l /dev/sda5 | grep "Block size"
    Block size:               4096
    

    Hope this can help....

    0 讨论(0)
  • 2021-02-05 04:08

    You can find out the approximate inode ratio by dividing the size of available space by the number of available inodes. For example:

    $ sudo tune2fs -l /dev/sda1 | awk -F: ' \
        /^Block count:/ { blocks = $2 } \
        /^Inode count:/ { inodes = $2 } \
        /^Block size:/ { block_size = $2 } \
        END { blocks_per_inode = blocks/inodes; \
              print "blocks per inode:\t", blocks_per_inode, \
                    "\nbytes per inode:\t", blocks_per_inode * block_size }'
    
    blocks per inode:    3.99759 
    bytes per inode:     16374.1
    
    0 讨论(0)
  • 2021-02-05 04:19

    The default bytes per inode is usually 16384, which is the default inode_ratio in /etc/mke2fs.conf (it's read prior to filesystem creation). If you're running out of inodes, you might try for example:

    mkfs.ext4 -i 8192 /dev/mapper/main-var2
    

    Another option that affects this is -T, typically -T news which further reduces it to 4096.

    Also, you can not change the number of inodes in a ext3 or ext4 filesystem without re-creating or hex-editing it. Reiser filesystems are dynamic so you'll never have an issue with them.

    0 讨论(0)
提交回复
热议问题