All of lore.kernel.org
 help / color / mirror / Atom feed
* exactly shrinking btrfs on a device?
@ 2024-04-05 22:22 Christoph Anton Mitterer
  2024-04-05 22:37 ` Roman Mamedov
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Anton Mitterer @ 2024-04-05 22:22 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-08  2:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 22:22 exactly shrinking btrfs on a device? Christoph Anton Mitterer
2024-04-05 22:37 ` 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

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.