Hello!
I know the question about how to shrink XFS filesystem has been discussed many
times, but once more...
Well, I have a 40Gb XFS filesystem. It has grown from 20Gb by editing
partition table and running xfs_growfs. No data has been written to
filesystem after growth.
Ok, now some theory... I need to shrink filesystem by 512Mb, or 64 cylinders.
I have internal log that is not crossing the bottom 64cyl boundary, data
block, and have no realtime block. When filesystem grown, number of
allocation groups has been incremented and more dblocks allocated. So, to
shrink filesystem I need to kill some allocation groups and decrease number
of dblocks.
That was theory. But how to implement this in practice? What I've tred:
- I ran sfdisk and decreased size of partition by 64 cylinders. After that
filesystem becomes unmountable, mount complains with 'illegal seek'. This
looks ok and it is safe to restore old partition size with sfdisk.
- Then I tried to run xfs_repair. Hmmm, xfs_repair gone to infinite loop
trying to recover superblock in 21th allocation group. This seems to be a bug
in xfs_repair...
- Ok, ran xfs_admin and looked at agcount and dblocks in superblock 0. Then I
decreased agcount by 2 and dblocks by 2 * number of blocks per ag.
After that filesystem became unmountable, complaining bad geometry data in
superblock. xfs_check gives away with tons of errors...
For now I stopped my experiments and restored agcount/dblocks values at
superblock, restored partitions size by sfdisk, and filesystem became
mountable again.
And here is question to XFS hackers: can I? :) As far as I see, no problem in
cutting filesystem tail if no data has been written to FS. But how to make it
with xfs_admin?
Thanks and sorry for my not-so-perfect English. ;)
Dmitry.
sinyavin@xxxxxxxxxxxx
|