Operating System - HP-UX
1833160 Members
3194 Online
110051 Solutions
New Discussion

Re: reducing filesystem and lvol size without data loss

 

reducing filesystem and lvol size without data loss

I have a vxfs filesystem under 11i, which sits on top of an lvol made up of 2 vdisks from an EVA.

If I have 60% free space in the filesystem, can I reduce the size with fsadm (I have onlineJFS) down to half the original size, then lvreduce off the last vdisk?

I started out with lvol1 with 1 vdisk, then had to add a vdisk and grow the filesystem. Now I have reduced the size of the data again, and no longer need the extra space. What I am hoping to do is free up a whole vdisk (can do this by reducing the filesystem), lvreduce off it and reclaim the space on the EVA.

Does the fsadm to reduce it take the space from the end of the filesystem? I assume it handles reallocating any data sitting after the new end of filesystem? I dont really understand how vxfs allocates extents - is it contiguous? if not, do I risk data loss this way?

Sorry for the long winded explaination :)
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: reducing filesystem and lvol size without data loss

Sounds like you need to spend some time with the man page for fsadm_vxfs. You would learn that the safest way is to use fsadm with the -e option to reorganize the extents. Supposedly in a Version 3 or above vxfs file system, this would happen automatically, while Version 2 will fail. I prefer to reorg regardless.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: reducing filesystem and lvol size without data loss

Hi Giles:

Yes, 'fsadm' can be used to decrease the size of a VxFS filesystem. Threeafter, you can downsize the encapsuling container --- the logical volume --- with 'lvreduce'. You can use 'pvmove' to move physical disk extents belonging to the logical volume from one physical volume to another, ultimately (if necessaary) allowing you to 'vgreduce' an entire physical volume out of the volume group.

The 'fsadm' manpages note:

/* begin quote */

In a Version 3 or above disk layout, if there are file system resources in use in the sectors being removed, fsadm relocates those resources to sectors staying within the resized file system. The time needed for relocation depends on the number of blocks being moved.

In older disk layouts, file system structural components are fixed, so reducing the size of a file system fails if there are file system resources in use in the sectors being removed. In that case, a reorganization (using fsadm -e) can free busy resources and allow shrinking the file system. If there are still file system structural components within the area to be removed, you must upgrade the file system to a Version 3 or above disk layout to do a resize (see vxupgrade(1M)).

/* end quote */

Regards!

...JRF...
SKR_1
Trusted Contributor

Re: reducing filesystem and lvol size without data loss

You can reduce the FS first with fsadm command and then you can reduce the lvol with lvreduce command. After this verify all the disks if they are free or not with pvdisplay command and then do vgreduce to take out the disk from Volume group.

Thanks

SKR
Michael Steele_2
Honored Contributor

Re: reducing filesystem and lvol size without data loss

I agree with the above responses about fsadm being used to reduce an lvol, but I am always concerned that there won't be enough defragmentation, and that some extents may still be addressing the end of the file systems, there by causing a loping off or truncation of these extents.

So I would advise one of two alternatives. To run fsadm -e -d until it shows no defragmentation, or to make a new lvol and copy the data over.
Support Fatherhood - Stop Family Law
James R. Ferguson
Acclaimed Contributor

Re: reducing filesystem and lvol size without data loss

Hi:

VxFS filesystems of layout version 3 (or earlier) often required defragmentation before they could be shrunk in size. Filesystems layout versions later than three (3) should not suffer this problem.

You can determine the layout version with:

# fstyp -v /dev/vgNN/lvolX

Regards!

...JRF...