Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* shrink btrfs partition - recommended way?
@ 2026-06-28 23:36 Ulli Horlacher
  2026-06-28 23:54 ` Roman Mamedov
  2026-06-29  0:42 ` Qu Wenruo
  0 siblings, 2 replies; 3+ messages in thread
From: Ulli Horlacher @ 2026-06-28 23:36 UTC (permalink / raw)
  To: linux-btrfs


Is there a recommended way (or tool) to shrink a btrfs partition?

I have:

root@zoo:~# lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS /dev/sdc
NAME    SIZE FSTYPE MOUNTPOINTS
sdc     256G
`-sdc1  256G btrfs  /LXC

root@zoo:~# df -Th /LXC
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sdc1      btrfs  256G   19G  236G   8% /LXC

And want to shrink /dev/sdc1 to 200 GB

I know, I can use btrfs filesystem resize and afterwards use fdisk to
delete /dev/sdc1, create a new smaller /dev/sdc1 and then add a new
/dev/sdc2 
BUT if make a calculation error with fdisk the btrfs filesystem will be
damaged.
gparted can do it all together in one step, but it needs X11, which I do
not have on host zoo. I have only text console access, no X11.
                                       
-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
REF:<20260628233658.GA3404176@tik.uni-stuttgart.de>

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

* Re: shrink btrfs partition - recommended way?
  2026-06-28 23:36 shrink btrfs partition - recommended way? Ulli Horlacher
@ 2026-06-28 23:54 ` Roman Mamedov
  2026-06-29  0:42 ` Qu Wenruo
  1 sibling, 0 replies; 3+ messages in thread
From: Roman Mamedov @ 2026-06-28 23:54 UTC (permalink / raw)
  To: Ulli Horlacher; +Cc: linux-btrfs

On Mon, 29 Jun 2026 01:36:58 +0200
Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote:

> 
> Is there a recommended way (or tool) to shrink a btrfs partition?
> 
> I have:
> 
> root@zoo:~# lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS /dev/sdc
> NAME    SIZE FSTYPE MOUNTPOINTS
> sdc     256G
> `-sdc1  256G btrfs  /LXC
> 
> root@zoo:~# df -Th /LXC
> Filesystem     Type   Size  Used Avail Use% Mounted on
> /dev/sdc1      btrfs  256G   19G  236G   8% /LXC
> 
> And want to shrink /dev/sdc1 to 200 GB
> 
> I know, I can use btrfs filesystem resize and afterwards use fdisk to
> delete /dev/sdc1, create a new smaller /dev/sdc1 and then add a new
> /dev/sdc2 
> BUT if make a calculation error with fdisk the btrfs filesystem will be
> damaged.
> gparted can do it all together in one step, but it needs X11, which I do
> not have on host zoo. I have only text console access, no X11.

I'd shrink it to like 180GB first, to avoid most chances of calculation and
GiB vs GB errors. As for shrinking the partition, 'cfdisk' has a resize
function. Then expand Btrfs to 'max'.

-- 
With respect,
Roman

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

* Re: shrink btrfs partition - recommended way?
  2026-06-28 23:36 shrink btrfs partition - recommended way? Ulli Horlacher
  2026-06-28 23:54 ` Roman Mamedov
@ 2026-06-29  0:42 ` Qu Wenruo
  1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2026-06-29  0:42 UTC (permalink / raw)
  To: linux-btrfs



在 2026/6/29 09:06, Ulli Horlacher 写道:
> 
> Is there a recommended way (or tool) to shrink a btrfs partition?
> 
> I have:
> 
> root@zoo:~# lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS /dev/sdc
> NAME    SIZE FSTYPE MOUNTPOINTS
> sdc     256G
> `-sdc1  256G btrfs  /LXC
> 
> root@zoo:~# df -Th /LXC
> Filesystem     Type   Size  Used Avail Use% Mounted on
> /dev/sdc1      btrfs  256G   19G  236G   8% /LXC
> 
> And want to shrink /dev/sdc1 to 200 GB
> 
> I know, I can use btrfs filesystem resize and afterwards use fdisk to
> delete /dev/sdc1, create a new smaller /dev/sdc1 and then add a new
> /dev/sdc2
> BUT if make a calculation error with fdisk the btrfs filesystem will be
> damaged.
> gparted can do it all together in one step, but it needs X11, which I do
> not have on host zoo. I have only text console access, no X11.
>                                         

You can sshrink the btrfs to a much smaller size, e.g. 32G, then shrink 
sdc1 to whatever you want.

There should be more than enough headroom, as 32G is way smaller than 
200G you want.

Then resize btrfs to max to take all the space again.

Thanks,
Qu

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

end of thread, other threads:[~2026-06-29  0:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-28 23:36 shrink btrfs partition - recommended way? Ulli Horlacher
2026-06-28 23:54 ` Roman Mamedov
2026-06-29  0:42 ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox