public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Why does not freeblocks number change after deleting a big file?
@ 2014-05-06  3:32 Younger Liu
  2014-05-06  9:57 ` Azat Khuzhin
  0 siblings, 1 reply; 3+ messages in thread
From: Younger Liu @ 2014-05-06  3:32 UTC (permalink / raw)
  To: linux-ext4

Hi:
  Analyze ext4 filesystem with "debugfs -R "stats" <device>",
Why does not free blocks number change after deleting a big file?

The big file:
# stat test
  file:"test"
  size:290554084       blocks:567496     IO block:4096

before deleting the file "test":
# debugfs -R "stats" /dev/sdb
...
Inode count:              243593216
Block count:              1948728320
Reserved block count:     97436416
Free blocks:              406830314
Free inodes:              151667854
...

deleting the file "test"
# debugfs -R "stats" /dev/sdb
...
Inode count:              243593216
Block count:              1948728320
Reserved block count:     97436416
Free blocks:              406830314
Free inodes:              151667854
...

     Younger
     thx.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why does not freeblocks number change after deleting a big file?
  2014-05-06  3:32 Why does not freeblocks number change after deleting a big file? Younger Liu
@ 2014-05-06  9:57 ` Azat Khuzhin
  2014-05-06 10:35   ` Lukáš Czerner
  0 siblings, 1 reply; 3+ messages in thread
From: Azat Khuzhin @ 2014-05-06  9:57 UTC (permalink / raw)
  To: Younger Liu; +Cc: linux-ext4

On Tue, May 06, 2014 at 11:32:12AM +0800, Younger Liu wrote:
> Hi:
>   Analyze ext4 filesystem with "debugfs -R "stats" <device>",
> Why does not free blocks number change after deleting a big file?
> 
> The big file:
> # stat test
>   file:"test"
>   size:290554084       blocks:567496     IO block:4096
> 
> before deleting the file "test":
> # debugfs -R "stats" /dev/sdb
> ...
> Inode count:              243593216
> Block count:              1948728320
> Reserved block count:     97436416
> Free blocks:              406830314
> Free inodes:              151667854
> ...
> 
> deleting the file "test"
> # debugfs -R "stats" /dev/sdb
> ...
> Inode count:              243593216
> Block count:              1948728320
> Reserved block count:     97436416
> Free blocks:              406830314
> Free inodes:              151667854

Hi,

Seems that you are trying to do this on a mounted partition, and the
super block are not dumped to disk after every write/flush.

You could use statfs(2) instead of debugfs/stats command, or "mount -o
remount /dev/sdb_X_" and after debugfs, this _must_ work only in case
you don't have journal.

For more information you could look into ext4_commit_super().

> ...
> 
>      Younger
>      thx.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Respectfully
Azat Khuzhin
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why does not freeblocks number change after deleting a big file?
  2014-05-06  9:57 ` Azat Khuzhin
@ 2014-05-06 10:35   ` Lukáš Czerner
  0 siblings, 0 replies; 3+ messages in thread
From: Lukáš Czerner @ 2014-05-06 10:35 UTC (permalink / raw)
  To: Azat Khuzhin; +Cc: Younger Liu, linux-ext4

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2308 bytes --]

On Tue, 6 May 2014, Azat Khuzhin wrote:

> Date: Tue, 6 May 2014 13:57:48 +0400
> From: Azat Khuzhin <a3at.mail@gmail.com>
> To: Younger Liu <younger.liucn@gmail.com>
> Cc: linux-ext4@vger.kernel.org
> Subject: Re: Why does not freeblocks number change after deleting a big file?
> 
> On Tue, May 06, 2014 at 11:32:12AM +0800, Younger Liu wrote:
> > Hi:
> >   Analyze ext4 filesystem with "debugfs -R "stats" <device>",
> > Why does not free blocks number change after deleting a big file?
> > 
> > The big file:
> > # stat test
> >   file:"test"
> >   size:290554084       blocks:567496     IO block:4096
> > 
> > before deleting the file "test":
> > # debugfs -R "stats" /dev/sdb
> > ...
> > Inode count:              243593216
> > Block count:              1948728320
> > Reserved block count:     97436416
> > Free blocks:              406830314
> > Free inodes:              151667854
> > ...
> > 
> > deleting the file "test"
> > # debugfs -R "stats" /dev/sdb
> > ...
> > Inode count:              243593216
> > Block count:              1948728320
> > Reserved block count:     97436416
> > Free blocks:              406830314
> > Free inodes:              151667854
> 
> Hi,
> 
> Seems that you are trying to do this on a mounted partition, and the
> super block are not dumped to disk after every write/flush.
> 
> You could use statfs(2) instead of debugfs/stats command, or "mount -o
> remount /dev/sdb_X_" and after debugfs, this _must_ work only in case
> you don't have journal.
> 
> For more information you could look into ext4_commit_super().

Yes, it really looks like you're doing this on mounted file system.
However we do not update the superblock for some of the summary
statistics such as number of free blocks, inodes and so on.

This is because it is recalculated from per block group
descriptors when the file system is mounted, or unmounted. So when
the file system is mounted debugfs is not going to give you an
accurate information. You have to use something else like 'stat -f'
for example.

Thanks!
-Lukas

> 
> > ...
> > 
> >      Younger
> >      thx.
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-06 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06  3:32 Why does not freeblocks number change after deleting a big file? Younger Liu
2014-05-06  9:57 ` Azat Khuzhin
2014-05-06 10:35   ` Lukáš Czerner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox