Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
xfsprogs 5.12 - shrinking support - anyone made any tests?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, Finland

PostPosted: Sun Oct 24, 2021 12:39 pm    Post subject: xfsprogs 5.12 - shrinking support - anyone made any tests? Reply with quote

xfs finally got shrinking support. Yay!
Eric Sandeen wrote:
*snip*
The condensed changelog since 5.11.0 is:

xfsprogs-5.12.0-rc1 (07 May 2021)
- mkfs: don't default to too-large physical sector size (Jeff Moyer)
- repair: phase 6 speedups (Dave Chinner, Gao Xiang)
- man: Add dax mount option to man xfs(5) (Carlos Maiolino)
- xfs_admin: pick up log arguments correctly (Darrick Wong)
- xfs_growfs: support shrinking unused space (Gao Xiang)
- libfrog: report inobtcount in geometry (Darrick Wong)
- xfs_logprint: Fix buffer overflow printing quotaoff (Carlos Maiolino)
- xfsprogs: include <signal.h> for platform_crash (Leah Neukirchen)
- xfsprogs: remove BMV_IF_NO_DMAPI_READ flag (Anthony Iliopoulos)
- workqueue: bound maximum queue depth (Dave Chinner)

xfsprogs-5.12.0-rc0 (12 Apr 2021)
- libxfs changes merged from kernel 5.12
*snip*
Anyone here tested it? On lvm?
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Sun Oct 24, 2021 4:16 pm    Post subject: Reply with quote

You mean like
Code:

lvresize --resizefs -L <new-reduced-size> /dev/vg/lv

That is so cool..
I will create an xfs lv just for testing and be back...
UNFORUNATELY it doesnt seem to work with sys-fs/xfsprogs-5.13.0 and 5.14.1-gentoo
Code:

lvresize --resizefs -L 1G /dev/test/test
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan (but don't clear) agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 0
No modify flag set, skipping phase 5
Phase 6 - check inode connectivity...
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify link counts...
No modify flag set, skipping filesystem flush and exiting.
fsadm: Xfs filesystem shrinking is unsupported.
  /sbin/fsadm failed: 1
  Filesystem resize failed.


when not mounted.
and
Code:

fsadm: Xfs filesystem shrinking is unsupported.
  /sbin/fsadm failed: 1
  Filesystem resize failed.


when mounted.
_________________
:)
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, Finland

PostPosted: Sun Oct 24, 2021 5:06 pm    Post subject: Reply with quote

I believe lvm just doesn't support it yet. Doing it "by hand", using xfs_growfs first to reduce the fs size then making sure it's aligned correctly and then finally using lvm to shrink the lv but leave the fs alone.
This operation, however is too prone to user errors, that I wouldn't try it on "real" data. :P

I guess we'll have to wait a little more for things to mature.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
tholin
Apprentice
Apprentice


Joined: 04 Oct 2008
Posts: 203

PostPosted: Tue Oct 26, 2021 2:51 pm    Post subject: Reply with quote

I took a look at the code and xfsprogs only calls the XFS_IOC_FSGROWFSDATA ioctl to let the kernel do the shrinking operation. The kernel code for doing xfs shrinking went into v5.13.

https://github.com/torvalds/linux/commit/fb2fc172018599a6564aab4ac0dce79bf94bd6bc
https://github.com/torvalds/linux/commit/46141dc891f7d28cc5cac473ad1a54a312c021c1

It looks like the kernel code only does shrinking by cutting away unused space at the end of the filesystem without trying to move any data. Shrinking like that only works if your free space happens to be right at the end of the fs and that's unlikely. Maybe the functionality will be improved in the future to also move data before the resize.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum