linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to resize (grow) device partition of a multi-device BTRFS filesystem?
@ 2013-01-11 23:39 Rick Liu
  2013-01-11 23:53 ` Joshua Schüler
  0 siblings, 1 reply; 8+ messages in thread
From: Rick Liu @ 2013-01-11 23:39 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

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


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

* Re: how to resize (grow) device partition of a multi-device BTRFS filesystem?
  2013-01-11 23:39 Rick Liu
@ 2013-01-11 23:53 ` Joshua Schüler
  0 siblings, 0 replies; 8+ messages in thread
From: Joshua Schüler @ 2013-01-11 23:53 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

On 12.01.2013 00:39, Rick Liu wrote:
> 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

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

* RE: how to resize (grow) device partition of a multi-device BTRFS filesystem?
@ 2013-01-12  0:29 Rick Liu
  2013-01-12  1:50 ` Hugo Mills
  0 siblings, 1 reply; 8+ messages in thread
From: Rick Liu @ 2013-01-12  0:29 UTC (permalink / raw)
  To: Joshua Schüler, linux-btrfs@vger.kernel.org

> 
> 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+


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

* Re: how to resize (grow) device partition of a multi-device BTRFS filesystem?
  2013-01-12  0:29 Rick Liu
@ 2013-01-12  1:50 ` Hugo Mills
  0 siblings, 0 replies; 8+ messages in thread
From: Hugo Mills @ 2013-01-12  1:50 UTC (permalink / raw)
  To: Rick Liu; +Cc: Joshua Schüler, linux-btrfs@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

On Sat, Jan 12, 2013 at 12:29:47AM +0000, Rick Liu wrote:
> > 
> > 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: hugo@... 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 ---       

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* RE: how to resize (grow) device partition of a multi-device BTRFS filesystem?
@ 2013-01-12  2:18 Rick Liu
  2013-01-12  2:28 ` Hugo Mills
  0 siblings, 1 reply; 8+ messages in thread
From: Rick Liu @ 2013-01-12  2:18 UTC (permalink / raw)
  To: Hugo Mills; +Cc: Joshua Schüler, linux-btrfs@vger.kernel.org

> 
>    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


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

* Re: how to resize (grow) device partition of a multi-device BTRFS filesystem?
  2013-01-12  2:18 how to resize (grow) device partition of a multi-device BTRFS filesystem? Rick Liu
@ 2013-01-12  2:28 ` Hugo Mills
  2013-01-12  3:11   ` Chris Murphy
  2013-01-12 11:06   ` Roman Mamedov
  0 siblings, 2 replies; 8+ messages in thread
From: Hugo Mills @ 2013-01-12  2:28 UTC (permalink / raw)
  To: Rick Liu; +Cc: Joshua Schüler, linux-btrfs@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]

On Sat, Jan 12, 2013 at 02:18:44AM +0000, Rick Liu wrote:
> > 
> >    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: hugo@... 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!                          

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: how to resize (grow) device partition of a multi-device BTRFS filesystem?
  2013-01-12  2:28 ` Hugo Mills
@ 2013-01-12  3:11   ` Chris Murphy
  2013-01-12 11:06   ` Roman Mamedov
  1 sibling, 0 replies; 8+ messages in thread
From: Chris Murphy @ 2013-01-12  3:11 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org BTRFS


On Jan 11, 2013, at 7:28 PM, Hugo Mills <hugo@carfax.org.uk> wrote:

> On Sat, Jan 12, 2013 at 02:18:44AM +0000, Rick Liu wrote:
>>> 
>>>   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

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

* Re: how to resize (grow) device partition of a multi-device BTRFS filesystem?
  2013-01-12  2:28 ` Hugo Mills
  2013-01-12  3:11   ` Chris Murphy
@ 2013-01-12 11:06   ` Roman Mamedov
  1 sibling, 0 replies; 8+ messages in thread
From: Roman Mamedov @ 2013-01-12 11:06 UTC (permalink / raw)
  To: Hugo Mills; +Cc: Rick Liu, Joshua Schüler, linux-btrfs@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

On Sat, 12 Jan 2013 02:28:49 +0000
Hugo Mills <hugo@carfax.org.uk> wrote:

> 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."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2013-01-12 11:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-12  2:18 how to resize (grow) device partition of a multi-device BTRFS filesystem? Rick Liu
2013-01-12  2:28 ` Hugo Mills
2013-01-12  3:11   ` Chris Murphy
2013-01-12 11:06   ` Roman Mamedov
  -- strict thread matches above, loose matches on Subject: below --
2013-01-12  0:29 Rick Liu
2013-01-12  1:50 ` Hugo Mills
2013-01-11 23:39 Rick Liu
2013-01-11 23:53 ` Joshua Schüler

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 NNTP newsgroup(s).