From: Li Zefan <lizf@cn.fujitsu.com>
To: "Fajar A. Nugraha" <list@fajar.net>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: fstrim on BTRFS
Date: Thu, 29 Dec 2011 17:39:59 +0800 [thread overview]
Message-ID: <4EFC356F.4060904@cn.fujitsu.com> (raw)
In-Reply-To: <CAG1y0scg0vA1jfrp7GX8m9Puh0HJWBNgABHiXqrOuUGgH6p8KQ@mail.gmail.com>
Fajar A. Nugraha wrote:
> On Wed, Dec 28, 2011 at 11:57 PM, Martin Steigerwald
> <Martin@lichtvoll.de> wrote:
>> But BTRFS does not:
>>
>> merkaba:~> fstrim -v /
>> /: 4431613952 bytes were trimmed
>> merkaba:~> fstrim -v /
>> /: 4341846016 bytes were trimmed
>
> .... and apparently it can't trim everything. Or maybe my kernel is
> just too old.
>
>
> $ sudo fstrim -v /
> 2258165760 Bytes was trimmed
>
> $ df -h /
> Filesystem Size Used Avail Use% Mounted on
> /dev/sda6 50G 34G 12G 75% /
>
> $ mount | grep "/ "
> /dev/sda6 on / type btrfs (rw,noatime,subvolid=258,compress-force=lzo)
>
> so only about 2G out of 12G can be trimmed. This is on kernel 3.1.4.
>
That's because only free spaces in block groups will be trimmed. Btrfs
allocates space from block groups, and when there's no space availabe,
it will allocate a new block group from the pool. In your case there's
~10G in the pool.
You can do a "btrfs fi df /", and you'll see the total size of existing
block groups.
You can empty the pool by:
# dd if=/dev/zero of=/mytmpfile bs=1M
Then release the space (but it won't return back to the pool):
# rm /mytmpfile
# sync
and try "btrfs fi df /" and trim again.
next prev parent reply other threads:[~2011-12-29 9:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-28 16:57 fstrim on BTRFS Martin Steigerwald
2011-12-29 4:02 ` Li Zefan
2011-12-29 4:21 ` Fajar A. Nugraha
2011-12-29 4:32 ` Fajar A. Nugraha
2011-12-29 4:37 ` Roman Mamedov
2011-12-29 4:42 ` Fajar A. Nugraha
2011-12-29 5:29 ` cwillu
2011-12-29 10:52 ` Martin Steigerwald
2012-01-03 21:05 ` Chris Mason
2011-12-29 4:29 ` Fajar A. Nugraha
2011-12-29 9:39 ` Li Zefan [this message]
2011-12-29 9:52 ` Fajar A. Nugraha
2011-12-30 6:19 ` Li Zefan
2011-12-30 6:35 ` Fajar A. Nugraha
-- strict thread matches above, loose matches on Subject: below --
2014-10-31 0:21 Noah Massey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EFC356F.4060904@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=list@fajar.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.