Why is the size of a directory either 0 or 4096?

Why is the size of a directory either 0 or 4096?

A directory is just a special file which contains an array of filenames and inode numbers. When the directory was created, the file system allocated 1 inode to the directory with a “filename” (dir name in fact). The inode points to a single data block (minimum overhead), which is 4096 bytes.

How does a data file shrink operation work?

A data file shrink operation works on a single file at a time, and uses the GAM bitmaps (see Inside The Storage Engine: GAM, SGAM, PFS and other allocation maps) to find the highest page allocated in the file. It then moves it as far towards the front of the file as it can, and so on, and so on.

What happens when I shrink my SQL Server database?

Shrinking typically causes index fragmentation, and that could be a significant performance cost. I would also recommend that after you shrink, you re-grow the files so that you have some free space. That way, when new rows come in, they don’t trigger autogrowth.

How big of a file allocation unit do I Need?

Some filesystems have some space in the inode that can be used to hold very small directories. But once the directory is large enough to not fit in that area, the OS will allocate an entire file allocation unit, which in your case is apparently 4096 bytes.

What are the inode numbers of a dot file?

The dot file, like every directory, contains a list of names for the files in this directory and their inode numbers. So if you once had lots of files in that directory (not unlikely for a “tmp” directory) that would have made the directory entry grow to this size.

How big is a directory in ext4 file system?

On typical ext4 file system (what most people use), the default inode size is 256 bytes, block size is 4096 bytes. A directory is just a special file which contains an array of filenames and inode numbers.

How big is an inode in ext4 file system?

On typical ext4 file system (what most people use), the default inode size is 256 bytes, block size is 4096 bytes.