Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Assume you have a file 342MB but when you get into that file and look the content of it; you see that everything occupy around 92 MB. No hidden file or any other thing exist on it.

How can that be possible. Is there a solution to fix this. Here is before and after mount

/data>du -sh *
342M   backup

/mnt> du -sh *
4K   etc
79M   kernel
8K   lost+found
13M   platform

Edit: Someone suggested hidden files, but there aren't any:

/mnt> ls -alrt
total 44
drwx------   2 root     root        8192 Mar 20 08:16 lost+found
drwxr-xr-x   2 root     root         512 Mar 20 08:16 etc
drwxr-xr-x  15 root     sys          512 Mar 20 08:16 kernel
drwxr-xr-x   6 root     root         512 Mar 20 08:16 .
drwxr-xr-x  41 root     root        1536 Mar 20 08:16 platform
drwxr-xr-x  41 root     root        9216 Apr  5 19:47 ..

df /mnt
/mnt               (/dev/lofi/2       ):  466192 blocks   162531 files

The command that show my backup file is 342 MB

 du -sh backup
 342M   backup

The command I used for mounting this backup file

lofiadm -a /home/backup
mount -F ufs /dev/lofi/2 /mnt

df -g output :

 df -g /mnt
 /mnt               (/dev/lofi/2       ):    8192 block size    1024 frag         size
 657548 total blocks     466192 free blocks   400438 available   163520 total files
 162531 free files     38535170 filesys id
 ufs fstype       0x00000004 flag             255 filename length

du -s output :

 du -s /mnt
 189292  /mnt
share|improve this question
can you once tell how you find out that the file size is 400 MB i.e. by which command. And how u are looking into content of it ?? – pradeepchhetri Apr 5 '12 at 7:14
I have edited the question thanks. – mibzer Apr 5 '12 at 7:23
Your question doesn't make any sense. What does “everything occupy” mean? Are you confusing files and directories? What happened between the two times you ran du -sh *: you seem to be in the same directory? If you mounted something, what was it and where? – Gilles Apr 5 '12 at 23:25
@Gilles sory for confusion. Well I have a backup file and it is size is 342 MB. But I could not see the content of this file. So I mount this file under /mnt directory. After his mount operation some how size of /mnt become 92 MB. What I am questioning is how that happens. Size of first backup file was 342 but when I mount, it became 92 MB – mibzer Apr 8 '12 at 21:24
@mibzer Copy-paste the following: the command that shows your backup fiile is 342MB; the command you used to mount the backup; after mounting, the output of df /mnt. – Gilles Apr 8 '12 at 21:37
up vote 2 down vote accepted

You have a filesystem image that contains around 92MB worth of files, as shown by the output of du -s /mnt (in blocks of 512 bytes) or du -sh /mnt or the output of df -g (657548 total blocks minus 466192 free blocks is 191356 occupied blocks, i.e. about 93MB). The rest of the image is free space.

share|improve this answer
is it there a way to clear this free space from image? – mibzer Apr 8 '12 at 22:33
@mibzer: gzip the file or qemu-img convert -O qcow2 test.dd test.qcow to convert it to qcow2. Mount using qemu ndb – Jodie C Apr 8 '12 at 22:40
@JodieC this is a solaris based system. I suppose that command will not work, right ? – mibzer Apr 8 '12 at 22:44
@mibzer The easiest way is to do whatever you did to create the image, but specify a size around 100MB for the filesystem instead of 342MB. Or see if Solaris includes a filesystem resizing utility. – Gilles Apr 8 '12 at 22:46
@Gilles thanks Sir, much appreciated. – mibzer Apr 8 '12 at 22:48

By default, du command shows only non-hidden files and directories. It doesn't show any hidden files which is occupying the rest of the space i.e. ~300MB in your case.

I tried the same thing in my laptop also in my home directory:

pradeep@pradeep-laptop:/home$ du -csh *
4.8G pradeep

4.8G total

pradeep@pradeep-laptop:/home/pradeep$ du -csh *
4.6M cscope.out
714M Desktop
2.6G Documents
4.0K examples.desktop
4.0K gomti
4.0K inot.c
20K java
36K Kernel Makefile
59M Macbuntu-10.10
244K modules
4.0K Music
4.0K NetBeansProjects
4.0K new
712K p4
3.0M Pictures
44K PradeepTranscript.html
4.0K Public
4.0K script
48K shell-script
51M systemtap-1.3
4.0K Templates
4.0K Ubuntu One
12K Videos

3.4G total

You can see the difference in total in the end of both the output.

This is because the hidden files and folders whose names are starting with dot(.) are taking the rest of the space.

share|improve this answer
I also checked file with ls -a. But there weren't any hidden files. Please see my edit – mibzer Apr 5 '12 at 13:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.