On Thursday, 20 April 2023 10:29:59 BST Dale wrote: > Frank Steinmetzger wrote: > > Am Wed, Apr 19, 2023 at 06:32:45PM -0500 schrieb Dale: > >> Frank Steinmetzger wrote: > >>> <<<SNIP>>> > >>> > >>> When formatting file systems, I usually lower the number of inodes from > >>> the > >>> default value to gain storage space. The default is one inode per 16 kB > >>> of > >>> FS size, which gives you 60 million inodes per TB. In practice, even one > >>> million per TB would be overkill in a use case like Dale’s media > >>> storage.¹ > >>> Removing 59 million inodes × 256 bytes ≈ 15 GB of net space for each TB, > >>> not counting extra control metadata and ext4 redundancies. > >> > >> If I ever rearrange my > >> drives again and can change the file system, I may reduce the inodes at > >> least on the ones I only have large files on. Still tho, given I use > >> LVM and all, maybe that isn't a great idea. As I add drives with LVM, I > >> assume it increases the inodes as well. > > > > I remember from yesterday that the manpage says that inodes are added > > according to the bytes-per-inode value. > > > >> I wonder. Is there a way to find out the smallest size file in a > >> directory or sub directory, largest files, then maybe a average file > >> size??? > > > > The 20 smallest: > > `find -type f -print0 | xargs -0 stat -c '%s %n' | sort -n | head -n 20` > > > > The 20 largest: either use tail instead of head or reverse sorting with > > -r. > > You can also first pipe the output of stat into a file so you can sort and > > analyse the list more efficiently, including calculating averages. > > When I first run this while in / itself, it occurred to me that it > doesn't specify what directory. I thought maybe changing to the > directory I want it to look at would work but get this: > > > root@fireball /home/dale/Desktop/Crypt # `find -type f -print0 | xargs > -0 stat -c '%s %n' | sort -n | head -n 20` > -bash: 2: command not found > root@fireball /home/dale/Desktop/Crypt # > > > It works if I'm in the / directory but not when I'm cd'd to the > directory I want to know about. I don't see a spot to change it. Ideas.
In place of "find -type..." say "find / -type..." -- Regards, Peter.