LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-14-2015, 09:46 PM   #1
pigsa
Member
 
Registered: Nov 2003
Location: Hong Kong
Posts: 35
Blog Entries: 1

Rep: Reputation: 15
Question Files with apparent size smaller than actual size?


I note some files with smaller apparent size that actual size, i.e., opposite to sparse file. It's a difference of 100MB, not a few KB. What sort of file is this, why, and how would one create such file?

Code:
[pigsa@pigsa journal]# du -h  *
101M    WiredTigerLog.0000000001
101M    WiredTigerPreplog.0000000001
[pigsa@pigsa journal]# du -h --apparent-size *
144K    WiredTigerLog.0000000001
128     WiredTigerPreplog.0000000001

Note:
1) Ext4 filesystem
2) These are oplog files of mongodb 3 wiredtiger storage engine... But I am interested in the phenenom of small apparent size, rather than what wiredtiger is.

Last edited by pigsa; 04-14-2015 at 10:06 PM.
 
Old 04-14-2015, 11:13 PM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
I think they are indeed sparse files.
 
Old 04-14-2015, 11:22 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Welcome to LQ!

It is the opposite of what you think it to be.

From man du:

Code:
--apparent-size
       print  apparent  sizes, rather than disk usage; although the 
       apparent size is usually smaller, it may be larger due 
       to holes in ('sparse') files, internal fragmentation, indirect 
       blocks, and  the like

Last edited by astrogeek; 04-14-2015 at 11:26 PM. Reason: quote to code and formatting
 
Old 04-15-2015, 01:04 AM   #4
pigsa
Member
 
Registered: Nov 2003
Location: Hong Kong
Posts: 35

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Eventually found that it is possible to produce such phenomenon using the fallocate command
 
  


Reply

Tags
du, ext4



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] fdisk shows logical sector size smaller than physical sector size? enine Slackware - Installation 5 09-03-2014 11:57 AM
Fdisk shows logical sector size smaller than physical sector size after clonezilla narnie Linux - Hardware 12 07-03-2013 09:01 PM
[SOLVED] [Lubuntu] Files' Size On Disk is ~ 10x Total Size Of Files! Zssfssz Linux - Software 2 02-22-2012 09:16 PM
making x.org virtual size match up with actual size tommyj27 Linux - Software 0 11-16-2004 06:53 PM
increase point size size when printing PDF files newlin Red Hat 0 09-27-2003 07:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:02 AM.

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
Open Source Consulting | Domain Registration