Some inode questions

Andreas Dilger
2009-05-05T21:59:45Z

On May 05, 2009  11:40 -0700, Ross Boylan wrote:
> When I first create /var I took all the defaults.  I have since decided
> that, since it will hold a cyrus mail spool (each message is a file) I
> should use something with more inodes.  I created a new (var2) partition
> and formatted it with
> # mkfs.ext3 -T news /dev/mapper/turtle-var2_crypt
> # news has inode_ratio = 4096
>
> Then I mounted and rsync'd from my existing /var.
> Afterwords, I get a report that seems to indicate I've used almost no
> inodes.  It also shows more inodes than blocks; is there any way one
> could need more than one inode/block?

Hard links, or empty files...

> As I read this, 6291445 of 6291456 inodes are free, so 11 are in use.
> The comparable calculation on the origin file system shows about 8,500
> inodes in use.

Indeed, it seems your new filesystem is empty.  That said, the superblock
contents are not updated on disk while the filesystem is mounted.  I have
argued that since we are already computing the superblock totals and
storing them into the superblock it wouldn't be harmful to write the
superblock to disk occasionally in ext[34]_statfs() by calling at the end:

	ext[34]_commit_super(sb, es, 0);

I don't think there is currently anything in ext[34] that is writing
the superblock to disk at all, except mount and unmount.

Using "df -i" should give you accurate numbers for a mounted
filesystem.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.