[wellylug] Partitioning - XFS resizing experience

David Antliff dave.antliff at paradise.net.nz
Mon Jul 5 15:08:11 NZST 2004


On Mon, 5 Jul 2004, jumbophut wrote:
> Resizing ext2/ext3/fat/swap filesystems and the partitions they reside
> on can be done with the parted tool, which was the base for qtparted.
> A floppy bootdisk containing parted can be created here:
> <http://www.gnu.org/software/parted/manual/html_node/parted_8.html>

I thought I'd just share my recent experience with resizing an XFS
filesystem which cannot be 'edited' with parted.  You can 'grow' an
existing XFS filesystem into empty space at the END of the existing
filesystem, but you cannot move or grow in the other direction. Unusually,
you perform this on a *mounted* filesystem.

Assuming existing XFS filesystem occupies an entire existing partition:

0. don't unmount/remount your XFS partition - do this all 'live' and in
one session with no reboots until step 6.
1. clear out space beyond existing partition (perhaps by deleting the next
partition) using fdisk or cfdisk.
2. determine the starting block of your existing XFS partition and write
it down. Also remember the partition number.
3. delete (yes you heard me right - delete) your XFS partition. No changes
until you save so don't worry...
4. recreate the new larger partition BUT make sure you give it the exact
same starting block and the exact same partition number. Failure to do
this will result in loss of the entire XFS filesystem. Double check.
5. save partition table to disk. At this point, your XFS filesystem still
exists in it's original size, but it's container partition is bigger. If
you got step 4 wrong, then you're on your own...
6. you can reboot at this point, but I'm not 100% sure if it's necessary -
the kernel might need to re-read the new partition table before you do
step 7. I think I rebooted.... maybe... or perhaps I didn't... hmm...
7. run xfs_growfs /dev/hdXY where X is the disk and Y the partition number
of your original XFS filesystem. This should complete fairly quickly (few
seconds) and there you go - nicely resized XFS filesystem.

As I mentioned I've actually done this and nothing went wrong.  But
standard disclaimer applies - I take no responsibility for anything you
choose to do with this information. The gentoo.org forum has more if you
want a second opinion (and I wouldn't blame you).

Now, I'd better get back to work :)

-- 
David.




More information about the wellylug mailing list