xfs
[Top] [All Lists]

Re: [Bug 319] New: wishlist: allow shrinking of XFS

To: Iustin Pop <iusty@xxxxxxxxx>
Subject: Re: [Bug 319] New: wishlist: allow shrinking of XFS
From: Steve Lord <lord@xxxxxxx>
Date: Mon, 22 Mar 2004 14:02:34 -0600
Cc: Chris Wedgwood <cw@xxxxxxxx>, bugzilla-daemon@xxxxxxxxxxx, xfs-master@xxxxxxxxxxx, brian@xxxxxxxxxxx
In-reply-to: <20040322194923.GA5404@xxxxxxxxxxxxxxxxxxxx>
References: <200403210050.i2L0oseZ003869@xxxxxxxxxxx> <20040321035738.GB4143@xxxxxxxxxxxxxxxxxxxxxxx> <20040322194923.GA5404@xxxxxxxxxxxxxxxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla Thunderbird 0.5 (X11/20040208)
Iustin Pop wrote:
> On Sat, Mar 20, 2004 at 07:57:38PM -0800, Chris Wedgwood wrote:
> 
>>On Sat, Mar 20, 2004 at 04:50:54PM -0800, bugzilla-daemon@xxxxxxxxxxx wrote:
>>
>>
>>>I would like to be able to shrink XFS filesystems.  This is useful
>>>for repartitioning or when using a volume management system.
>>
>>FWIW this is a fair amount of work and potentially will break some
>>things.  I'm not entirely sure it's worth considering as people tend
>>to grow filesystems much more often the shrink them.
> 
> 
> Couldn't this be implemented by taking offline the last AG(s)? This
> would be similar to growing, where you add a (some) new AG(s) and put
> the online, just the reverse.
> 
> 
> Regards,
> Iustin Pop
> 

Its a little more complex than that, when you grow, you add empty space to
the fs, when you shrink, you have to move files out of the space being
removed.

So, lets say you want to chop the last 4 allocation groups off an xfs
filesystem. You need to find all the inodes within this space, and move
them somewhere else. You also need to find all the files which have
contents in this space - which is not the same as the inodes being
in this space, and relocate the contents of those extents back down
to somewhere else in the fs. Note that the extents you have to deal
with are not just file data..... Any extended attributes need replicating,
symlink contents, directory contents etc (you could have a directory whose
inode is not in the space being freed, and which points at no inodes in the
space being freed, but which has disk blocks in the space being freed).

The only way to really do this is a complete tree walk of all the metadata
in the filesystem looking for any inode which has a metadata or data block
in the allocation groups being freed, and reallocate that space elsewhere.

Not quite just the reverse of adding more free space ;-)

Steve


<Prev in Thread] Current Thread [Next in Thread>