on a CentOS release 6.8 (Final) I was looking around and noticed the following in a directory. [jason at server /app-vol/applications/]$ls -ld temp drwxr-xr-x 4 jason users 2899968 Feb 18 06:31 temp/ [jason at server /app-vol/applications/]$ How does the directory *itself* have a size of 2.8 megs? yes the contents in that temp directory add up to 2.8 megs, but.. umm. huh? when I run a stat on the temp directory, i get File: `temp' Size: 2899968 Blocks: 5672 IO Block: 4096 directory Device: fd02h/64770d Inode: 1836137 Links: 4 Access: (0755/drwxr-xr-x) Uid: ( 1022/ jason) Gid: ( 501/ users) Access: 2017-02-22 06:31:51.414190071 -0500 Modify: 2017-02-18 06:31:56.135448424 -0500 Change: 2017-02-18 06:31:56.135448424 -0500 on other "normal" directories, I see something like Size: 4096 Blocks: 8 IO Block: 4096 directory Jason
On 02/22/2017 06:34 AM, Jason Welsh wrote:> How does the directory *itself* have a size of 2.8 megs?If you write a large number of directory entries in a directory, the directory will grow in order to provide storage for those directory entries. You can imagine a directory as a text file containing all of the file names in the directory, with references to the location of those files, if that helps you understand why the directory itself will grow.
So its normal behavior.. thanks! Jason On 02/22/2017 01:40 PM, Gordon Messmer wrote:> On 02/22/2017 06:34 AM, Jason Welsh wrote: >> How does the directory *itself* have a size of 2.8 megs? > > > If you write a large number of directory entries in a directory, the > directory will grow in order to provide storage for those directory > entries. You can imagine a directory as a text file containing all of > the file names in the directory, with references to the location of > those files, if that helps you understand why the directory itself > will grow. > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos
On 2/22/2017 10:40 AM, Gordon Messmer wrote:> On 02/22/2017 06:34 AM, Jason Welsh wrote: >> How does the directory *itself* have a size of 2.8 megs? > > > If you write a large number of directory entries in a directory, the > directory will grow in order to provide storage for those directory > entries. You can imagine a directory as a text file containing all of > the file names in the directory, with references to the location of > those files, if that helps you understand why the directory itself > will grow.on many modern file systems, larger directories are stored as some sort of B-Tree or hash tree, so there's quite a lot of indexing data in there along with the actual directory entries. -- john r pierce, recycling bits in santa cruz