Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Hugo Mills <hugo@carfax.org.uk>
To: Robert White <rwhite@pobox.com>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: btrfs filesystem show _exact_ freaking size?
Date: Tue, 18 Nov 2014 10:59:34 +0000	[thread overview]
Message-ID: <20141118105934.GK32735@carfax.org.uk> (raw)
In-Reply-To: <546B21F4.8060203@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

On Tue, Nov 18, 2014 at 02:39:48AM -0800, Robert White wrote:
> Howdy,
> 
> How does one get the exact size (in blocks preferably, but bytes
> okay) of the filesystem inside a partition? I know how to get the
> partition size, but that's not useful when shrinking a partition...
> 
> So, for example, you successfully do
> 
> btrfs filesystem resize -32G /dev/sdz2
> 
> now you've got "some space" zero idea how many sectors can be
> trimmed off the end of the partition, you can do the math but thats
> a little iffy, especially if the file system didn't originally fill
> the partition to begin with.
> 
> The current methodology for most such actions is to way over-trim
> the file system, then reallocate the space using your partition tool
> of choice, then re-grow the filesystem to fit. This has been the way
> of things forever and it blows...
> 
> There needs to be an option to btrfs filesystem show that will tell
> you XXXXXblocks, not Y.ZZ terabytes.

   The 3.17 userspace tools should now support flags to select the
display units in some detail, including bytes.

   Even without that, though, for your use case, I would recommend
shrinking the FS by *more* than you wanted to shrink, resizing the
partition, and then resizing the FS back up to fit the partition
exactly (with btrfs fi resize n:max).

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
                 --- Stick them with the pointy end ---                  

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-11-18 10:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 10:39 btrfs filesystem show _exact_ freaking size? Robert White
2014-11-18 10:59 ` Hugo Mills [this message]
2014-11-18 11:26 ` Gabriel de Perthuis
2014-11-18 12:41 ` Duncan

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=20141118105934.GK32735@carfax.org.uk \
    --to=hugo@carfax.org.uk \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rwhite@pobox.com \
    /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