Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an empty disk mounted as /data

The df -h shows me that 188M are used while a du -h shows me 4,0K.

root@marc:~# du -h --max-depth=1 /data
4,0K    /data

root@marc:~# df -h
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/sdb1          910G    117G  747G  14% /
udev               3,9G    8,0K  3,9G   1% /dev
tmpfs              1,6G    808K  1,6G   1% /run
none               5,0M       0  5,0M   0% /run/lock
none               3,9G    164K  3,9G   1% /run/shm
AFS                8,6G       0  8,6G   0% /afs
/dev/sdc1          230G    197G   21G  91% /backup
/dev/sda1          230G    188M  218G   1% /data

I was planning to reformat the disk in order to install a new system on it but I would like to know what these 188M are.

The /dev/sda1 is formated as ext4 partition. Could this be ext4 specific information I can safely erase ?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

Filesystems like ext3 or ext4 use journaling mechanism. It helps to protect the filesystem consistency when situations like power outage or system crash happen. Whenever metadata (data) are changed they are first written to the journal without changing the rest of the filesystem. Once all of those changes have been journaled the changes are commited and the kernel can continue with writing actual metada (data) to the disk.

The ext3/ext4 journal is maintained on a dedicated portion of the filesystem. In your case, it occupies 188MB of the filesystem on /dev/sda1.

You can try to create an ext3/ext4 filesystem without journal (on spare partition)

mkfs.ext4 -O ^has_journal /dev/sdXY

to see the difference. You can find more about ext3/ex4 journaling in the related man pages of mkfs.ext3 or man mkfs.ext4 commands.

share|improve this answer
2  
I understand the intention behind showing how to create a file system without journal. But you should not use the resulting file system unless you know exactly what you are doing. Just for the record. –  scai Aug 19 '13 at 11:20

The answer lies in man page of du and df. Let me quote

NAME
   df - report file system disk space usage


NAME
   du - estimate file space usage

When you run du -h --max-depth=1 /data it tries to find the first level directories (i.e. just the directories inside /data directory) and shows how much space they have taken. Unless you specify --block-size= it will show in human readable format i.e. 1 KiB or 1024 bytes. So, inside your /data directory, you have 4,0 KiB of data. NOTE - this is size of data.

But when you run df on it, it calculates the filesystem size of /data and that is the total space of the filesystem. So, you get big space.

And it has nothing to do with ext3 or ext4.

share|improve this answer
    
Someone give me the rationale of downvoting the answer. I am very keen to know and learn from you. –  Soham Chakraborty Aug 19 '13 at 17:05
    
I didn't down vote. The 4K yield by du is not the problem. The problem is the 188M. Apparently It's the file system usage. So it has to do with ext3 and ext4. This is probably the reason your answer was wnvoted. The later has a journaling system which I guess now is reserving the 188M. –  chmike Aug 20 '13 at 13:21
    
Yeah that's reserve space usage (5%) for root fs so that the root fs doesn't go to ENOPSC error. Now it looks like I misunderstood the question. Anyway, cheers. –  Soham Chakraborty Aug 20 '13 at 17:10

Your Answer

 
discard

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.