Andrea Conti writes:
> > AFAIK you will gain more inodes when you increase the size.
>
> Only because by unless you specify a value mke2fs allocates a number of
> inodes proportional to the size of the filesystem, with the default
> being 1 inode every 16kB (see /etc/mke2fs.conf).
>
> But for ext[234] the number of inodes is fixed at filesystem creation,
> so even if you use LVM you can't increase it by -- say -- growing the
> underlying LV and then using resize2fs.
So I just tried that, create a small fs, filled it until no inodes were
left. Resized, and gained more inodes:
weird ~ # lvcreate -L 4M -n inodetest weird
Logical volume "inodetest" created
weird ~ # mke2fs -j /dev/weird/inodetest
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
1024 inodes, 4096 blocks
[...]
weird ~ # mount /dev/weird/inodetest /mnt/
weird ~ # for (( i=1; ; i++ ))
> do
> touch "/mnt/$( printf "file %06d" $i )" || break
> done
touch: cannot touch `/mnt/file 001014': No space left on device
weird ~ # df -i /mnt/
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/weird-inodetest 1024 1024 0 100% /mnt
weird ~ # lvresize -L 16M /dev/weird/inodetest
Extending logical volume inodetest to 16,00 MiB
Logical volume inodetest successfully resized
weird ~ # resize2fs /dev/weird/inodetest
resize2fs 1.41.14 (22-Dec-2010)
Filesystem at /dev/weird/inodetest is mounted on /mnt; on-line resizing
required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/weird/inodetest to 16384 (1k) blocks.
The filesystem on /dev/weird/inodetest is now 16384 blocks long.
weird ~ # df -i /mnt/
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/weird-inodetest 2048 1024 1024 50% /mnt
Wonko