LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-03-2013, 01:31 AM   #1
raj k yadav
LQ Newbie
 
Registered: Dec 2008
Posts: 27

Rep: Reputation: 2
size of a blank file


Why the size of a blank directory is 8K when the data block size is 4K.

[root@ pgsql]# ll /p05_old/pgsql/builderdb/
total 0
[root@pgsql]# du -sk /p05_old/pgsql/builderdb/
8 /p05_old/pgsql/builderdb/
[root@ pgsql]#
 
Old 11-03-2013, 02:23 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Quote:
Originally Posted by raj k yadav View Post
Why the size of a blank directory is 8K when the data block size is 4K.

[root@ pgsql]# ll /p05_old/pgsql/builderdb/
total 0
[root@pgsql]# du -sk /p05_old/pgsql/builderdb/
8 /p05_old/pgsql/builderdb/
[root@ pgsql]#
Assuming an ext2/3/4 file system: I've answered a related question a few days ago: 4096

If you empty a directory these blocks are not reduced. This is a feature (or problem if you want) of the ext2/3/4 file system. The only easy way to reduce the amount of blocks assigned is to delete the directory and re-create it again.

Although I never used it myself the e2fsck command does have an option to optimize directories in file systems: the -D option. Do have a look at the man page for some extra information.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script to get name of file, delete original file, rename blank file chrisgti Linux - General 11 09-15-2012 02:49 AM
[SOLVED] Store the size of largest file from a file/directory listing into variable SIZE lainey Linux - Newbie 3 11-15-2011 12:29 PM
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
file system size larger than fysical size:superblock or partition table corrupt klizon Linux - General 0 06-18-2004 04:18 PM
Replace blank/almost blank lines in file Wynd Linux - General 3 01-27-2004 04:49 PM


All times are GMT -5. The time now is 03:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration