Discussion:
how to resize (grow) device partition of a multi-device BTRFS filesystem?
Rick Liu
2013-01-11 23:39:22 UTC
Permalink
Hi,

I'm running OpenSUSE12.2 on VMware ESXi5.
I create /local using BTRFS file system with 3 devices (sdc, sdd, sde).
These 3 devices are VMware's virtual disk (vmdk files).

Instead of adding another new virtual disk,
ESXi allows to increase Virtual Disk size,
so I increase the size for 3 devices (sdc, sdd, sde) from 300GB to 500GB for each.

In EXT4 file system,
I can resize (grow) partition directly.
How to do this on BTRFS partition?



Thanks,

Rick

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Joshua Schüler
2013-01-11 23:53:49 UTC
Permalink
Post by Rick Liu
Hi,
I'm running OpenSUSE12.2 on VMware ESXi5.
I create /local using BTRFS file system with 3 devices (sdc, sdd, sde).
These 3 devices are VMware's virtual disk (vmdk files).
Instead of adding another new virtual disk,
ESXi allows to increase Virtual Disk size,
so I increase the size for 3 devices (sdc, sdd, sde) from 300GB to 500GB for each.
In EXT4 file system,
I can resize (grow) partition directly.
How to do this on BTRFS partition?
Thanks,
Rick
Hi Rick,

use
btrfs fi resize <devid>:max
to make btrfs use all space of disk <devid>

Joshua
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Rick Liu
2013-01-12 00:29:47 UTC
Permalink
Post by Joshua Schüler
Hi Rick,
use
btrfs fi resize <devid>:max
to make btrfs use all space of disk <devid>
[Rick Liu]
Hi,

I tried, but it seems no effect.
(dev/sdc was 300GB and now is 500GB, )
After resize,
/dev/sdc1 is still 300GB.


# btrfs filesystem show
Label: 'local' uuid: 828bee8c-a28c-443f-b19a-8e65e3f94963
Total devices 3 FS bytes used 372.22GB
devid 3 size 500.00GB used 259.06GB path /dev/sde1
devid 4 size 500.00GB used 260.06GB path /dev/sdd
devid 5 size 300.00GB used 0.00 path /dev/sdc1
Btrfs v0.19+

# btrfs fi resize 5:max /local
Resize '/local' of '5:max'

# btrfs filesystem show
Label: 'local' uuid: 828bee8c-a28c-443f-b19a-8e65e3f94963
Total devices 3 FS bytes used 372.22GB
devid 3 size 500.00GB used 259.06GB path /dev/sde1
devid 4 size 500.00GB used 260.06GB path /dev/sdd
devid 5 size 300.00GB used 0.00 path /dev/sdc1
Btrfs v0.19+

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hugo Mills
2013-01-12 01:50:21 UTC
Permalink
Post by Rick Liu
Post by Joshua Schüler
Hi Rick,
use
btrfs fi resize <devid>:max
to make btrfs use all space of disk <devid>
[Rick Liu]
Hi,
I tried, but it seems no effect.
(dev/sdc was 300GB and now is 500GB, )
After resize,
/dev/sdc1 is still 300GB.
You'll need to use something like fdisk or cfdisk to resize the
partition first. With (c)fdisk, that involves deleting and recreating
the partition with the same starting point. (fdisk gives you more
control here). As with most low-level FS-resizing tools, btrfs fi
resize doesn't attempt to change the size of the underlying device.

Hugo.
--
=== Hugo Mills: ***@... carfax.org.uk | darksatanic.net | lug.org.uk ===
PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
--- Great oxymorons of the world, no. 6: Mature Student ---
Rick Liu
2013-01-12 02:18:44 UTC
Permalink
Post by Hugo Mills
You'll need to use something like fdisk or cfdisk to resize the
partition first. With (c)fdisk, that involves deleting and recreating
the partition with the same starting point. (fdisk gives you more
control here). As with most low-level FS-resizing tools, btrfs fi
resize doesn't attempt to change the size of the underlying device.
Hugo.
[Rick Liu]
I see.
So that means unlike ext4 filesystem,
which I can use resize2fs on line to grow partition without losing data,
BTRFS must re-create partition table (fdisk) and loss data.

I'll then use a workaround:
add new bigger virtual disk.

Thank for your help,

Rick

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hugo Mills
2013-01-12 02:28:49 UTC
Permalink
Post by Rick Liu
Post by Hugo Mills
You'll need to use something like fdisk or cfdisk to resize the
partition first. With (c)fdisk, that involves deleting and recreating
the partition with the same starting point. (fdisk gives you more
control here). As with most low-level FS-resizing tools, btrfs fi
resize doesn't attempt to change the size of the underlying device.
Hugo.
[Rick Liu]
I see.
So that means unlike ext4 filesystem,
which I can use resize2fs on line to grow partition without losing data,
BTRFS must re-create partition table (fdisk) and loss data.
No, with resize2fs, you also need to resize the partition, using
the same process. Deleting and enlarging a partition doesn't change
any of the data in it. resize2fs doesn't modify partition tables. (Or
at least, didn't the last time I really looked at it in detail).

As long as the start of the partition isn't changed, deleting and
resizing in fdisk isn't damaging. It's just... slightly disconcerting.
:) (It's also been the standard way of resizing the device for as long
as I can remember).

The thing to remember is that a filesystem and a partition are two
different things. The partition is a *container*, and the filesystem
is an area of structured data within that container.

(c)fdisk changes the definition of the container, but doesn't
modify the bytes stored on the underlying storage device. The
fs-resizing tools (btrfs fi resize / resize2fs) change the limits on
the data structures to match the container.

Finally, the other thing to remember is that if you're increasing
size, change the block device first, then the filesystem. (i.e. fdisk,
then btrfs fi resize). If you're shrinking, change the filesystem
first, then the block device (i.e. btrfs fi resize, then fdisk).

Hugo.
--
=== Hugo Mills: ***@... carfax.org.uk | darksatanic.net | lug.org.uk ===
PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
--- Klytus! Are your men on the right pills? Maybe you should ---
execute their trainer!
Chris Murphy
2013-01-12 03:11:19 UTC
Permalink
Post by Hugo Mills
Post by Rick Liu
Post by Hugo Mills
You'll need to use something like fdisk or cfdisk to resize the
partition first. With (c)fdisk, that involves deleting and recreating
the partition with the same starting point. (fdisk gives you more
control here). As with most low-level FS-resizing tools, btrfs fi
resize doesn't attempt to change the size of the underlying device.
Hugo.
[Rick Liu]
I see.
So that means unlike ext4 filesystem,
which I can use resize2fs on line to grow partition without losing data,
BTRFS must re-create partition table (fdisk) and loss data.
No, with resize2fs, you also need to resize the partition, using
the same process. Deleting and enlarging a partition doesn't change
any of the data in it. resize2fs doesn't modify partition tables. (Or
at least, didn't the last time I really looked at it in detail).
It's does not. To grow you must first change the size of the container: the partition, the LV, or array device. Then you can resize the file system. It's the same with XFS, and NTFS. I'm only aware of Apple's diskutil resizevolume command that resizes the flavors of HFS+ and at the same time sets the new end value for the partition entry.

Chris Murphy--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Roman Mamedov
2013-01-12 11:06:45 UTC
Permalink
On Sat, 12 Jan 2013 02:28:49 +0000
Post by Hugo Mills
As long as the start of the partition isn't changed, deleting and
resizing in fdisk isn't damaging. It's just... slightly disconcerting.
:)
For that reason I very much prefer the cfdisk implementation from the
gnu-fdisk package. It has an option to really resize the partition. While
resizing the filesystem within it will usually fail, the dialog goes like this:

Select the patition, click "Resize".

"Failed to resize filesystem, change partition size (EXPERT)?" - "Yes"

"Start location? [Fixed start], [Specify different]?" - "Fixed start"

"Partition size? [Max is nnnnMB]" - "nnnnMB".

Done.
--
With respect,
Roman

~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Stallman had a printer,
with code he could not see.
So he began to tinker,
and set the software free."
Loading...