Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262
Rep:
running out of inodes
Hi
I have the following issue related to inode quantity on ext3 file system.
Structure of /home file system looks like there is a lot of small files.
I have free space on my file system but don't have free inodes and I can't write to it.
Output from 'mount' cmd. File system /home is ext3 type.
Code:
[root@redhat5 ~]# mount
/dev/mapper/rootvg-rootlv on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/rootvg-tmplv on /tmp type ext3 (rw)
/dev/mapper/rootvg-varlv on /var type ext3 (rw)
/dev/mapper/rootvg-homelv on /home type ext3 (rw)
/dev/mapper/rootvg-usrlv on /usr type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
I get the following error when try to create a new file.
Code:
[root@redhat5 jakubn]# touch file2.txt
touch: cannot touch `file2.txt': No space left on device
thx for help.
Last edited by drManhattan; 05-10-2011 at 04:51 PM.
I think there are many files (probably few bytes, may be of zero byte) in any of the home directories of users which has fully used the inodes of the /home file system.
In order to save yourself always remember to have quota enabled.
Anyways, try to use the below commands to find any files which you feel would be junk.
Code:
find . -size 0 # looks for zero size files
OR
find . -size -1k # looks for files less than 1 KB
Last edited by vikas027; 05-10-2011 at 07:24 PM.
Reason: Corrected typo error
As far as I know it is not possible the change the amount of inodes. You have to backup your files and reformat with a higher amount of inodes if you want to keep a big number of small files.
[root@centos11 /]# resize2fs -p /dev/mapper/rootvg-storage
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/rootvg-storage is mounted on /share; on-line resizing required
Performing an on-line resize of /dev/mapper/rootvg-storage to 1286144 (4k) blocks.
The filesystem on /dev/mapper/rootvg-storage is now 1286144 blocks long.
Content of /share fs after expanding storage, the old structure remains the same, only space is bigger on this fs.
Code:
[root@centos11 /]# ls -la /share
total 32
drwxr-xr-x 3 root root 4096 May 11 16:31 .
drwxr-xr-x 26 root root 4096 May 11 15:35 ..
drwx------ 2 root root 16384 May 11 16:27 lost+found
-rw-r--r-- 1 root root 18 May 11 16:31 test_file.txt
If I wanted to exand inode quantity I had to backup files from /share fs and recreacte fs with additional parameter -N <inode_quantity>, which tells mkfs cmd to create desired by me inode quantity.
Code:
[root@centos11 /]# mkfs -t ext3 -m 1 -v -N 800000 /dev/rootvg/storage
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
800000 inodes, 1286144 blocks
12861 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1317011456
40 block groups
32768 blocks per group, 32768 fragments per group
20000 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
After reformatiing with desired inode quantity entire fs content is lost.
Code:
[root@centos11 share]# ls -la /share
total 28
drwxr-xr-x 3 root root 4096 May 11 16:46 .
drwxr-xr-x 26 root root 4096 May 11 15:35 ..
drwx------ 2 root root 16384 May 11 16:46 lost+found
But inode quantity is bigger from 750080 to 800000 nr.
I don't understand how to calc inodes to bytes storage.
Knowledge :
------------
When ext3 file system is created, specific number of inodes is created.
Questions :
-----------
- what decides how many inodes will be created on file system if not specified ?
thx for help.
Generally, we do not need to define inodes at the time of creation of filesystem.
But, if in case you feel like you can try something like the below mke2fs command.
Code:
mke2fs -N 10000 /dev/sda1
Here, 10000 are the number of Inodes.
But, I still doubt this would solve you issue, as if there is some script/process which is continuously creating files (and thus consuming lnodes) will again haunt you.
By the way, did you tried my suggestion posted here.
Last edited by vikas027; 05-11-2011 at 02:33 PM.
Reason: Hyperlinked mke2fs
Have a more in depth read of http://linux.die.net/man/8/mkfs.ext3, with particular ref to -b, -i, -O, -T options. See also the refs to the relevant conf file.
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262
Original Poster
Rep:
'chrism01' I understand mkfs command but have two question.
From quote below I don't understand the difference between -d vs -I.
Quote:
-b block-size
Specify the size of blocks in bytes. Valid block size vales are 1024, 2048 and 4096 bytes per block. If omitted, mke2fs block-size is heuristically determined by the file system size and the expected usage of the filesystem (see the -T option). If block-size is negative, then mke2fs will use heuristics to determine the appropriate block size, with the constraint that the block size will be at least block-size bytes. This is useful for certain hardware devices which require that the blocksize be a multiple of 2k.
-i bytes-per-inode
Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode ratio, the fewer inodes will be created. This value generally shouldn't be smaller than the blocksize of the filesystem, since then too many inodes will be made. Be warned that is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter.
Questions :
-----------
1. If I create fs with this cmd `mkfs -t ext3 -N 700000 -d 2048 /dev/mapper/rootvg-homelv`, it will create 800000 inodes and block size of 2048 B ?
2. If I create fs with `mkfs -t ext3 -d 2048 -i 65536 /dev/mapper/rootvg-homelv`, does it mean that 65536 B will be block size of this fs ?
Please try to use the exact switch you mean (& Linux is case sensitive).
Anyway, I'd start by discovering your current block size http://www.cyberciti.biz/tips/determ...isk-quota.html. For a modern distro, I'd expect a default of 4096.
Compare this to avg size of files in qn. I'd prob not mess with this.
Then, I'd ignore -i switch and just use -N
Quote:
-N number-of-inodes
overrides the default calculation of the number of inodes that should be reserved for the filesystem (which is based on the number of blocks and the bytes-per-inode ratio). This allows the user to specify the number of desired inodes directly.
Remember, an inode is just an index entry; 1 for each file & dir you create (dir is a file in *nix)
/proc/sys/fs/inode-max
This file contains the maximum number of in-memory inodes. On
some (2.4) systems, it may not be present. This value should be
3-4 times larger than the value in file-max, since stdin, stdout
and network sockets also need an inode to handle them. When you
regularly run out of inodes, you need to increase this value.
and:
/proc/sys/fs/inode-state
This file contains seven numbers: nr_inodes, nr_free_inodes,
preshrink and four dummy values. nr_inodes is the number of
inodes the system has allocated. This can be slightly more than
inode-max because Linux allocates them one page full at a time.
nr_free_inodes represents the number of free inodes. preshrink
is non-zero when the nr_inodes > inode-max and the system needs
to prune the inode list instead of allocating more.
So you could use adjust this using sysctl for persistence or just change it on the fly to get you by until you can address the underlying issue as suggested above? Haven't tried it to know if you can do it on the fly and whatnot...Just a thought...
The /proc/fs/inode-max file doesn't exist on mine though, but it is a 2.6 kernel, maybe it's outdated or not applicable...?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.