linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: djwong <djwong@us.ibm.com>
To: Daniel Drake <dsd@laptop.org>
Cc: linux-ext4@vger.kernel.org
Subject: Re: Determining if an ext4 fs uses the whole partition
Date: Mon, 30 Apr 2012 10:33:04 -0700	[thread overview]
Message-ID: <20120430173304.GF6938@tux1.beaverton.ibm.com> (raw)
In-Reply-To: <CAMLZHHSi=1U=-V+qMOOunPnuSWDcTm81aSjXdnc51kvYk=n_vA@mail.gmail.com>

On Mon, Apr 30, 2012 at 11:19:31AM -0600, Daniel Drake wrote:
> Hi,
> 
> OLPC has started using ext4 online resizing to grow our filesystems to
> use the whole SD card on first boot - something we never did before.
> Working very nicely, thanks!
> 
> I'm trying to simplify/improve the scripts involved in doing this.
> 
> How can I programatically check if an ext4 fs already fills its
> partition, or if it has room to grow?

Is it not the case that there's room to grow if:

(ext4_block_count * ext4_block_size) - (bdev_size * 512) >= ext4_block_size

> The numbers produced by dumpe2fs (e.g. block count) or "df" don't seem
> to exactly line up with the sizes produced by fdisk.

How far off are the counts?  A small number of sectors, or many?

--D

> One easy solution, if possible, would be to find out the number of the
> last sector used by the filesystem. I could then very easily compare
> this to the "end" information found in sysfs for the partition. Then I
> can make the decision on whether to grow or not.
> 
> Thanks
> Daniel
> --
> 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
> 


      parent reply	other threads:[~2012-04-30 17:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 17:19 Determining if an ext4 fs uses the whole partition Daniel Drake
2012-04-30 17:29 ` Eric Sandeen
2012-04-30 17:37   ` Jeff Moyer
2012-04-30 19:01     ` Ted Ts'o
2012-04-30 18:18   ` Daniel Drake
2012-04-30 18:26     ` Eric Sandeen
2012-04-30 17:33 ` djwong [this message]

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=20120430173304.GF6938@tux1.beaverton.ibm.com \
    --to=djwong@us.ibm.com \
    --cc=dsd@laptop.org \
    --cc=linux-ext4@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).