Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

533
Visualizações
Yii2: Reducing inodes usage on vServer

On my Linux vServer the inodes are limited (e.g. 250.000). I found that an Yii2 installation requires quite a lot of inodes. The number of inode is roughly the number of files and directories.

The number of inodes used in the current directory and its subdirectories can be determined with

find .  -xdev -printf '%h\n' | sort | uniq -c | awk '{total = total + $1}END{print total}'

An average of my Yii2 projects is about 30k inodes. There are not much in files in ./web/assets, in the ./runtime or ./web/images folders. Most of the inodes are used in the ./vendor directory.

So the number of my Yii2 projects is limited to 8 projects.

What can I do to reduce inode usage in Yii2 projects?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Assuming you have root in your Linux vServer, you can embed a new filesystem in a single file and mount it. Such a file would take only a single inode in the parent filesystem while the number of inodes within the image is up to you.

# dd if=/dev/zero of=myfs bs=1MB count=512
512+0 records in
512+0 records out
512000000 bytes (512 MB) copied, 4.10134 s, 125 MB/s
# losetup --find --show `pwd`/myfs
/dev/loop0
# mkfs -t ext4 -i 1024 /dev/loop0
mke2fs 1.42.12 (29-Aug-2014)
Discarding device blocks: done
Creating filesystem with 500000 1k blocks and 500464 inodes
Filesystem UUID: fef5ab29-8991-4f99-8a27-80b4d11b3133
Superblock backups stored on blocks:
        8177, 24529, 40881, 57233, 73585, 204401, 220753, 400625

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

# mount /dev/loop0 /mnt
# df -i | sed -n '1p;/mnt/p'
Filesystem     Inodes  IUsed  IFree IUse% Mounted on
/dev/loop0     500464     11 500453    1% /mnt

Here, I chose ext4 and set the bytes-per-inode, -i, to its minimum value, giving the largest inode count, 500464, for 512MiB on ext4.

You could make multiple filesystems this way, one for each project, or make a much larger one with many more inodes.

To mount the image at the next reboot, add a line to /etc/fstab.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda