Inode table Addition

Source: Internet
Author: User
Tags inode usage

Partitions such as Linux ext3 have inode tables, which are used to store information such as the file location. Generally, a file occupies 1 ~ Two inode values. In the web system, if the HTML method is used, a large number of small files will be generated, and a large number of inode values will be used for the moment. Therefore, there are often a lot of file space remaining, but because inode is full, Linux will also report that there is no space and files cannot be added.
Depending on this situation, you may need to adjust the disk inode size.
If the disk contains small files, you can add inode values as appropriate.
If there are many large files, you can reduce the inode space in a proper amount. Of course, this is not necessary, and inode is not used for a large amount of time, saving a lot.
You can use mkfs to adjust the inode value.
Methods and cases:
0. Push and prepare some data and materials
At present, I need to increase the inode value of my partition/dev/sda9 (Mount at/var/www) to 2500000 (the original value is 2000640 ).
My system: Ubuntu 8.04 Desktop
View Source
Print?
1df # obtain current disk loading usage
2df-I # obtain the current disk inode usage to estimate the target inode
3cat/etc/fstab # output the current fstab. After inode is modified, the uuid will be modified. Therefore, the file needs to be adjusted accordingly. You need to record it. The best is to back up CP.
4cp-Ar/var/www/home/bak/# Back up all data to another partition/home. If inode is adjusted, the entire partition is formatted and deleted.

1. umount
View Source
Print?
1 sudo umount/var/WWW # WWW is the disk where I want to adjust inode. Of course, before umount, You need to close some processes that use it. For example, Apache or other services

2. mkfs. ext2, adjust inode
Note !!!!!!!!!! This operation will delete the data of the entire partition. Before this operation, please confirm that you have backed up the partition information.
Please confirm again that all your data has been backed up.
View Source
Print?
1 sudo mkfs. ext2-N 2500000/dev/sda9 #2500000 is the inode value I need/dev/sda9 is my/var/WWW disk.
There will be some output similar to this, the specific meaning is not table:

Mke2fs 1.40.8 (13-Mar-2008)
Filesystem label =
OS type: Linux
Block size = 4096 (log = 2)
Fragment size = 4096 (log = 2)
2503680 inodes, 3905795 Blocks
195289 blocks (5.00%) reserved for the Super User
First data block = 0
Maximum filesystem blocks = 4001366016
120 block groups
32768 blocks per group, 32768 fragments per group
20864 inodes per group
Superblock backups stored on blocks:
32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208
Writing inode tables: Done
Writing superblocks and filesystem accounting information: Done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs-C or-I to override.

3. Update partitions
View Source
Print?
1 sudo tune2fs-J/dev/sda9

4. Update the system UUID.
View Source
Print?
1 sudo udevtrigger
5. Obtain the new UUID and record it.
View Source
Print?
1 sudo vol_id-U/dev/sda9
6. Modify fstab and replace the New UUID.
View Source
Print?
1 sudo VI/etc/fstab
It is possible that you also need to adjust the uuid value of/dev/sda1 or others accordingly. You can use the following statements to check and update the uuid until Mount-A does not report an error.
View Source
Print?
1 sudo umount-
2 sudo Mount-
7. Finally, after Mount-A is passed, run the push phase command to view the new settings.

Rollenc @ rollenc-kubuntu :~ $ DF-I
File System inode (I) used (I) available (I) used % mount point
/Dev/sda9 2503680 11 2503669 1%/var/WWW

The inode value has been increased. Of course, some deviations are acceptable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.