Re: Filesystem oddity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, Jan 18th 2006 at 11:13 -0000, quoth Dan Track:

=>Hi
=>
=>I just came across this odd thing.
=>
=>Basically my problem was to find all empty directories on the /tmp
=>filesystem.  Initially I thought that all empty directories would be
=>8.0Kwhen running "du -hs". With this impression I ran my script. The
=>results I
=>got were inconsistent with my theory. It found many directories with one
=>file in them and these directories were also 8.0K in size.
=>
=>I'd liek to ask how this is possible, is this something to do with blocks on
=>the filesystem. And how does the command: find /tmp -type d -empty, what
=>parameter does it use to find an empty directory?
=>
=>Thanks in advance
=>Dan
=>

Every directory is created with one block. The size of the directory will 
grow if the number of entries in exceeds acertain number. (Not sure but I 
think it's around 180?)

When a file is deleted, the allocation bit in the directory is simply 
deallocated and directories never ever get smaller. That's why lost+found 
directories are created by first creating the directory and then creating 
1024 files in it and then deleting them. That way fsck won't have to 
allocate a block for a directory while the filesystem is in a funky state.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux