Skip to content

Commit b472f96

Browse files
calestyokdave
authored andcommitted
btrfs-progs: docs: how to get the length of the portion used by btrfs on a device
A user who wants to shrink a btrfs filesystem within some other logical device (like a partition) will likely want to adapt the size of the underlying device, too. This commit adds documentation that describes how the length of the portion that btrfs uses of some device can be found out. Thanks go out to Roman Mamedov <[email protected]> for hinting `btrfs filesystem show` as alternative command. Note: the granularity is one sectorsize and the input values are silently rounded down to avoid bugs from converted filesystems that would not adhere to the native btrfs constraints. [ci skip] Pull-request: #775 Signed-off-by: Christoph Anton Mitterer <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 59676d1 commit b472f96

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Documentation/btrfs-filesystem.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,20 @@ resize [options] [<devid>:][+/-]<size>[kKmMgGtTpPeE]|[<devid>:]max <path>
251251
The resize command does not manipulate the size of underlying
252252
partition. If you wish to enlarge/reduce a filesystem, you must make sure you
253253
expand the partition before enlarging the filesystem and shrink the
254-
partition after reducing the size of the filesystem. This can done using
254+
partition after reducing the size of the filesystem. This can be done using
255255
:manref:`fdisk(8)` or :manref:`parted(8)` to delete the existing partition and recreate
256256
it with the new desired size. When recreating the partition make sure to use
257257
the same starting partition offset as before.
258258

259+
The size of the portion that the filesystem uses of an underlying device can be
260+
determined via the :command:`btrfs filesystem show --raw` command on the
261+
filesystem’s mount point (where it’s given for each *devid* after the string
262+
`size` or via the :command:`btrfs inspect-internal dump-super` command on the
263+
specific device (where it’s given as the value of `dev_item.total_bytes`, which
264+
is not to be confused with `total_bytes`).
265+
The value is also the address of the first byte not used by the
266+
filesystem.
267+
259268
Growing is usually instant as it only updates the size. However, shrinking could
260269
take a long time if there are data in the device area that's beyond the new
261270
end. Relocation of the data takes time.

0 commit comments

Comments
 (0)