Re: how to resize (grow) device partition of a multi-device BTRFS filesystem?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux