From: Christoph Anton Mitterer <calestyo@scientia.org>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: exactly shrinking btrfs on a device?
Date: Sat, 06 Apr 2024 00:22:52 +0200 [thread overview]
Message-ID: <896a5d36071a30605c38779dd03103b6429ebcae.camel@scientia.org> (raw)
Hey.
Assuming one has a btrfs (e.g. even on multiple devices)... one can
shrink the total fs via:
btrfs filesystem resize
(or even it's usage on a specific device via
btrfs filesystem resize devid:… )
If that btrfs on some given device was placed within some other
container (e.g. a partition, LUKS, LVM, etc.) one likely wants to next
shrink that outer container.
How does one do that? I mean, how do I find out the exact last by that
btrfs uses on a particular device?
Is it what btrfs inspect-internal dump-super /dev/<particular device>
gives me as:
dev_item.total_bytes ...
?
Is that always a multiple of 512?
And I'd assume that's the length, so the address of the last used byte
would be dev_item.total_bytes - 1 ?
Respectively if I have that fs in a partition like:
Number Start (sector) End (sector) Size Code Name
2 2097152 976773119 464.8 GiB 8300 Linux filesystem
That would mean, the last used / end sector is :
2097152 + ceil(dev_item.total_bytes/512) - 1
Does that sound right?
Cheers,
Chris.
next reply other threads:[~2024-04-05 22:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 22:22 Christoph Anton Mitterer [this message]
2024-04-05 22:37 ` exactly shrinking btrfs on a device? Roman Mamedov
2024-04-05 22:41 ` Christoph Anton Mitterer
2024-04-06 5:03 ` Andrei Borzenkov
2024-04-07 2:52 ` Christoph Anton Mitterer
2024-04-07 14:29 ` Roman Mamedov
2024-04-08 2:00 ` Christoph Anton Mitterer
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=896a5d36071a30605c38779dd03103b6429ebcae.camel@scientia.org \
--to=calestyo@scientia.org \
--cc=linux-btrfs@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 read-only IMAP folder(s) and NNTP newsgroup(s).