Operating System - HP-UX
1752579 Members
2946 Online
108788 Solutions
New Discussion юеВ

Re: Reduce a FS with fsadm

 
SOLVED
Go to solution
catastro
Super Advisor

Reduce a FS with fsadm

Hi, I need to reduce or redistribute an lvol that is using three different disks as I made a mistake when I increased the size of the lvol.
Now I am trying to reduce it with fsadm but always tells me that there is a block that is being used. I already tried to use fsadm on monouser mode but the system tells me that I have no license to operate the software (I am able to use it in multiuser mode).
How can I reduce the last block of the lvol for making the mirror to be right again in the same two disks as before?
7 REPLIES 7
Sundar_7
Honored Contributor

Re: Reduce a FS with fsadm


Try a defragmentation first.

# fsadm -F vxfs -d -D -e -E /filesystem

When the defrag completes, try reducing the filesystem

# fsadm -F vxfs -b m /filesystem

Note the appix "m".

lvreduce the lv.

As always, it is a very important to have a good backup of the filesystem before you try to reduce. At times, it may not just go very well.
Learn What to do ,How to do and more importantly When to do ?
Florian Heigl (new acc)
Honored Contributor

Re: Reduce a FS with fsadm


Normally this message means that You are trying the filesystem below what is currently IN USE in that filesystem. This often happens to me if I mix up the numbers.

Don't try to change the lvol size or mirroring config until You're done with the filesystem shrink.

There is another possible reason:
- Filesystem fragmentation:
fsadm -Fvxfs -de /mountpoint should correct the filesystem block allocation so that you can reduce the filesystem.

if you have vxfs version 4 or above, try to make it work in multiuser mode, this is easier to debug.

steps (just for verification)


let's assume 17GB current size, and 8GB in use
fsadm -Fvxfs -de /fs
fsadm -Fvxfs -b 8192M /fs
lvreduce -L 8192 /dev/vgNN/lvolXX
lvreduce -m 0 /dev/vgNN/lvolXX
# use PVGs to simplify the next step
pvmove -n /dev/vgNN/lvolXX /dev/dsk/wrong_disk /dev/dsk/wrong_disk /dev/dsk/right_disk

Then, ummm, redistribute, extend as wished


Regards,
Florian
yesterday I stood at the edge. Today I'm one step ahead.
catastro
Super Advisor

Re: Reduce a FS with fsadm

Thanks, it helped in the task, but finally what I did after reducinf the FS is that I broke the mirror and made it again under the disk I wanted it to be.
But the question now, I am trying to make the extend the lvol again, and it extends it always on the three first disks, and I have enough disk space for extending it on my two original disks. I use this command:

# lvextend -L 1300 /dev/vg00/lvol6
My PE size is 16 Mb, and my lvol actually has 976 Mb (61 PE in each of the two disks).

--- Physical volumes ---
PV Name /dev/dsk/c1t2d0
PV Status available
Total PE 4374
Free PE 3452
Autoswitch On

PV Name /dev/dsk/c1t0d0
PV Status available
Total PE 1085
Free PE 85
Autoswitch On

PV Name /dev/dsk/c2t2d0
PV Status available
Total PE 4374
Free PE 3452
Autoswitch On

PV Name /dev/dsk/c2t0d0
PV Status available
Total PE 1085
Free PE 85
Autoswitch On
Sundar_7
Honored Contributor
Solution

Re: Reduce a FS with fsadm

lvextend will always pick the PVs in the order they were added to the VG (with the default allocation policy).

If you would like to extend the LV on specific disks, then you will need to specificy them in the lvextend command

# lvextend -L 1300 /dev/vg04/lvol6 /dev/dsk/cXtYdZ /dev/dsk/c..... /dev/dsk/c.....

Learn What to do ,How to do and more importantly When to do ?
Florian Heigl (new acc)
Honored Contributor

Re: Reduce a FS with fsadm

You should really look into using pvg's

it looks like this in /etc/lvmtab

VG /dev/vgname
PVG ORIG_PVG
/dev/dsk/c1t2d0
/dev/dsk/c1t3d0
PVG MIRR_PVG
/dev/dsk/c2t8d0
/dev/dsk/c2t9d0

then
lvreduce -A n -m 0 /dev/vgname/lvolname
lvchange -A n -s g /dev/vgname/lvolname
lvextend -m 1 /dev/vgname/lvolname

and hp-ux will automatically distribute the mirrors accordingly, though it might be advisable to do this a bit more extensively. like, first split all mirrors, then pvmove so no PE on the MIRR_PVG disks are allocated, then lvchange, remirror.

After that you won't run into uneven mirrors ever again.

yesterday I stood at the edge. Today I'm one step ahead.
catastro
Super Advisor

Re: Reduce a FS with fsadm

Thanks sundar, it solved my issue definetly.
The of making the pvg I┬┤ll have a look at it as soon as I have some more time, but is a good idea thou.
Thanks to all of you.
Florian Heigl (new acc)
Honored Contributor

Re: Reduce a FS with fsadm

Note (I hope you have email updates on)

I made a big typo: it's /etc/lvmpvg (manually created), not /etc/lvmtab (never to be edited)

Florian
yesterday I stood at the edge. Today I'm one step ahead.