Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 06-17-2010, 04:49 PM   #1
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 997

Rep: Reputation: 130Reputation: 130
nilfs2 / How2 check disk space & eventually free it


I did some benchmarking on a USB-stick (flash memory) of nilfs2 vs. ext2 & ext3 and nilfs2 seems to be the best.

I know that nilfs2 does checkpoints and that's ok, but I don't fully understand how it handles free/used disk space:

How can I check how much unused space (excluding checkpoints) is left on the device?
E.g. after writing and deleting a file I still see that the space that was used by the file is still allocated even if no files are present:
nas1 memstick # ls -ltrh
total 0
nas1 memstick # df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/sde3              14G  2.9G   11G  22% /mnt/memstick
Does that allocated space get freed up somehow automatically when no space is left (garbage collector?) or do I have to free it up manually?

Don't find those answers in the docs - perhaps they're too obvious or I just missed them...?

Thanks a lot!
Old 06-17-2010, 05:14 PM   #2
Senior Member
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Has something recently changed in nilfs2? Last I ran benchmarks and most of them I've seen online show it has pretty dismal performance comparative to just about everything except in a couple specific circumstances (and even then ext3 out performed it.)

Nilfs2 is interesting imo but it's to new to be trusted with anything you want to keep reliably stored (ditto on ext4, btrfs, etc.) is one example of what I mean... note where bigger is better and where lower is better specifically.
1 members found this post helpful.
Old 06-17-2010, 06:32 PM   #3
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
I don't know how to check how much space is free on the device other than to see how much is on it (with du) and then subtract that from however big the device is. When you've made a change to the file system and deleted some files it takes a while for the nilfs_cleanerd (a process that runs in the background) to reclaim the freed space. Sometimes it can take a while, particularly if the filesystem is almost full.
1 members found this post helpful.
Old 06-18-2010, 04:15 PM   #4
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 997

Original Poster
Rep: Reputation: 130Reputation: 130
Thanks a lot for your replies!!

Well, I remember that some time ago I saw some benchmarks against nilfs2 and I agree with you remembering that the results for NILFS2 weren't good. I didn't test it back then, but what I tested now gave me a good impression.
Here are the tests I ran yesterday evening & their results:

The link to the tests you posted are interesting.
I programmed some time ago an app which was using an interface to sqlite and I know that if not instructed differently it uses a "sync"-approach and that result matches what I saw in my tests as the final "sync" when using nilfs2 didn't almost take any time in any occasion, contrarily to ext3.
For the 4GB-write&read performance I now get different results - perhaps something changed in the meanwhile in the code as the article is dated June 2009.
The other tests, like the 32-thread read tests are not relevant for me as I don't have e.g. an Oracle DB or a cluster using that FS - it's just a tiny, shy OS...

Andrew Benton:
Hehe..., I was hoping not to get such an answer but it looks like that's the only way to see the real used space.

Even ignoring that yesterday evening I was waiting for at least 10 minutes without seeing the garbage collector/cleanerd doing anything, today after remeounting the partition the garbage collector woke up and cleared 2.8GB and it stopped there (I know that in reality the free space should be around 13GB out of the 16)......and now?
Anyway I started writing a 4GB file and the limit seems to be at 1.4GB free space - I am writing and writing and the free space is stuck at 1.4GB (still with "df -h"). Now it finished writing the 4GB-file and I started writing one more - the free space is slowly decreasing down to 800MB and now I interrupted the write. Now (I'm doing nothing) the free space varies (funny, or?) between 864MB and 840MB and I see the LED activity on the USB-stick... . I see an increase in CPU-time of "nilfs_clearnerd" and everything still blinking but no changes to the free space... - "lscp" still shows all old checkpoints (never did any manual ones). It started blinking on the 65th minute of England-Algeria and it's still blinking at the 81st minute......CPU-time of "nilfs_clearnerd" increasing..... no differences with "lscp" nor "df -h".... boring.

As an experiment I will now unmount the partition to see if that happens immediately......yes - unmounted.

Now I will remount it....done. "df -h" now shows 1.2GB free space (?)....waiting (as the USB-stick is blinking)... . At 84th of Englang-Algeria it shows 1.5GB free...... at 85th it shows 1.7GB free and it stopped blinking - and I see that the old checkpoints have vanished.

Well, quite a funny FS. I think I'll try to use it.

Thanks guys for your posts!!
Just go on posting answers if you don't agree with anything or have anything more to add!!!

Last edited by Pearlseattle; 06-18-2010 at 04:24 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
partition space and disk space usage and free don't match nsic Linux - Newbie 3 02-22-2013 01:57 PM
how to check my disk free space sanjay2004 Linux - Server 8 04-24-2010 01:09 AM
How to check the free space available on the whole disk ? victvishwa Linux - Server 20 06-15-2009 06:26 PM
how do you check the free space mahmoud Linux - Newbie 2 01-03-2008 11:32 AM
How to check free disk space TigerLinux Linux - Newbie 9 10-04-2005 06:04 PM > Forums > Linux Forums > Linux - General

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration