Este contenido no está disponible en el idioma seleccionado.
6.3. Resizing a btrfs File System
It is not possible to resize a btrfs file system but it is possible to resize each of the devices it uses. If there is only one device in use then this works the same as resizing the file system. If there are multiple devices in use then they must be manually resized to achieve the desired result.
Note
The unit size is not case specific; it accepts both
G
or g
for GiB.
The command does not accept
t
for terabytes or p
for petabytes. It only accepts k
, m
, and g
.
Enlarging a btrfs File System
To enlarge the file system on a single device, use the command:
# btrfs filesystem resize amount /mount-point
For example:
# btrfs filesystem resize +200M /btrfssingle Resize '/btrfssingle' of '+200M'
To enlarge a multi-device file system, the device to be enlarged must be specified. First, show all devices that have a btrfs file system at a specified mount point:
# btrfs filesystem show /mount-point
For example:
# btrfs filesystem show /btrfstest Label: none uuid: 755b41b7-7a20-4a24-abb3-45fdbed1ab39 Total devices 4 FS bytes used 192.00KiB devid 1 size 1.00GiB used 224.75MiB path /dev/vdc devid 2 size 524.00MiB used 204.75MiB path /dev/vdd devid 3 size 1.00GiB used 8.00MiB path /dev/vde devid 4 size 1.00GiB used 8.00MiB path /dev/vdf Btrfs v3.16.2
Then, after identifying the
devid
of the device to be enlarged, use the following command:
# btrfs filesystem resize devid:amount /mount-point
For example:
# btrfs filesystem resize 2:+200M /btrfstest Resize '/btrfstest/' of '2:+200M'
Note
The amount can also be
max
instead of a specified amount. This will use all remaining free space on the device.
Shrinking a btrfs File System
To shrink the file system on a single device, use the command:
# btrfs filesystem resize amount /mount-point
For example:
# btrfs filesystem resize -200M /btrfssingle Resize '/btrfssingle' of '-200M'
To shrink a multi-device file system, the device to be shrunk must be specified. First, show all devices that have a btrfs file system at a specified mount point:
# btrfs filesystem show /mount-point
For example:
# btrfs filesystem show /btrfstest Label: none uuid: 755b41b7-7a20-4a24-abb3-45fdbed1ab39 Total devices 4 FS bytes used 192.00KiB devid 1 size 1.00GiB used 224.75MiB path /dev/vdc devid 2 size 524.00MiB used 204.75MiB path /dev/vdd devid 3 size 1.00GiB used 8.00MiB path /dev/vde devid 4 size 1.00GiB used 8.00MiB path /dev/vdf Btrfs v3.16.2
Then, after identifying the
devid
of the device to be shrunk, use the following command:
# btrfs filesystem resize devid:amount /mount-point
For example:
# btrfs filesystem resize 2:-200M /btrfstest Resize '/btrfstest' of '2:-200M'
Set the File System Size
To set the file system to a specific size on a single device, use the command:
# btrfs filesystem resize amount /mount-point
For example:
# btrfs filesystem resize 700M /btrfssingle Resize '/btrfssingle' of '700M'
To set the file system size of a multi-device file system, the device to be changed must be specified. First, show all devices that have a btrfs file system at the specified mount point:
# btrfs filesystem show /mount-point
For example:
# btrfs filesystem show /btrfstest Label: none uuid: 755b41b7-7a20-4a24-abb3-45fdbed1ab39 Total devices 4 FS bytes used 192.00KiB devid 1 size 1.00GiB used 224.75MiB path /dev/vdc devid 2 size 724.00MiB used 204.75MiB path /dev/vdd devid 3 size 1.00GiB used 8.00MiB path /dev/vde devid 4 size 1.00GiB used 8.00MiB path /dev/vdf Btrfs v3.16.2
Then, after identifying the
devid
of the device to be changed, use the following command:
# btrfs filesystem resize devid:amount /mount-point
For example:
# btrfs filesystem resize 2:300M /btrfstest Resize '/btrfstest' of '2:300M'