1835896 Members
3139 Online
110086 Solutions
New Discussion

Re: Can't reduce a lv

 
SOLVED
Go to solution
GerGon
Regular Advisor

Can't reduce a lv

Hi gurus,

Recently, I added one disk to a vg and done extend the lv and filesystem too. I keep in notepad the old Mb size.

But know, I need to get the disk out, but I get error, I don't know why the command doesn't work...?

I don't have the jfsonline, but I can down the aplication without problem. And the PE on the new added disk don't have information on it.

My OS version is hpux 11.0

I had read all lvreduce threads but they don't describe problem most like my own.
The only clear for me is, I must create a newfs to get the old size again.

My old value for the lvcoobk was 17776640Mb, adding the disk (c1t0d0) the new value is 26624000Mb.

The lvreduce command fail, still batting with parameters.

# lvreduce -L 17776640 /dev/vgdatos/lvcoolbk /dev/dsk/c1t0d0
"PhysicalVolumePath": Can be used only if "-m" has been specified.

# lvreduce -L 17776640 /dev/vgdatos/lvcoolbk
lvreduce: "LogicalExtentNumber" is not smaller than current setting;
therefore no logical extents are removed.

Please, check my attach file.

How do I to get out the disk c1t0d0 from the lvcoolbk and from the vg too?

Where is my problem? How can I solve it?

Thanks a lot.
11 REPLIES 11
James R. Ferguson
Acclaimed Contributor

Re: Can't reduce a lv

Hi:

First, you are not mirroring, so the specification of 'pv_path' cannot be made. Second, your filesystem is still mounted. Unmount the filesystem, add the '-f' option to the 'lvreduce' and execute:

# lvreduce -f -L 17776640 /dev/vgdatos/lvcoolbk

The filesystem will now be in a corrupted state. 'newfs' the filesystem and reload any data you want.

When there are no more extents allocated to the physical disk you want to reclaim, then you can 'vgreduce' it from the volume group.

Regards!

...JRF...
Rene Mendez_4
Super Advisor

Re: Can't reduce a lv

You need remember: lvreduce corrupt the file system.

Ejem de lvreduce without corrupt:
# tar ?cvf /dev/rmt/0m /base
# umount /base
# fsck -F vxfs /dev/vg00/base -y
# newfs ?F vxfs ?s 16384(tama?o en Kb) /dev/vg01/rbase

# lvreduce ?L 16(tama?o Mb) /dev/vg01/base
# mount /dev/vg01/base /base
# fsck -F vxfs /dev/vg00/base -y
# tar ?xvf /dev/rmt/0m


Regards
Rene
GerGon
Regular Advisor

Re: Can't reduce a lv

Any command work...!!

The problem continue, again..

See follow errors:

[root@pacifico]/> lvreduce -f -L 17776640 /dev/vgdatos/lvcoolbk
lvreduce: "LogicalExtentNumber" is not smaller than current setting;
therefore no logical extents are removed.
[root@pacifico]/>
[root@pacifico]/> fsck -F vxfs /dev/vg00/lvcoolbk
vxfs fsck: cannot stat /dev/vg00/lvcoolbk
[root@pacifico]/> bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 360448 35922 304256 11% /
/dev/vg00/lvol1 151509 37192 99166 27% /stand
/dev/vg00/lvol8 1089536 540061 515451 51% /var
/dev/vg00/lvutil 7340032 1000903 5943096 14% /util
/dev/vg00/lvol7 802816 594850 194987 75% /usr
/dev/vg00/lvol4 81920 1989 75481 3% /tmp
/dev/vg00/lvora 2867200 2020678 793684 72% /oracle
/dev/vg00/lvol6 409600 337844 67325 83% /opt
/dev/vg00/lvol5 20480 1364 17973 7% /home
/dev/vgdatos/lvdatos
17780736 3356 17499680 0% /datos
[root@pacifico]/> fsck -F vxfs /dev/vg00/rlvcoolbk
vxfs fsck: cannot stat /dev/vg00/rlvcoolbk
[root@pacifico]/>
Con O'Kelly
Honored Contributor

Re: Can't reduce a lv

Hi

To clarify the situation for you. The "lvreduce" command is in fact pretty useless with out OnlineJFS (unless you want to remove a mirror).
If you do not have OnlineJFS, the correct way to reduce to an LV is as follows:
1. Backup the LV (eg tar, cpio, fbackup etc)& verify the backup.
2. umount the Filesystem
# umount /back
3. Reduce the logical Volume to the new size
# lvreduce -L /dev/vgdatos/lvcoolbk
4. Recreate the Filesystem
# newfs -F vxfs /dev/vgdatos/rlvcoolbk
5. Mount FS
# mount /back
6. Restore data to /back filesystem.

I'd guess from the messages you are getting that you have already reduced the LV (check with lvdisplay). As Michael said you need to create a new FS (see step 4) & then restore your data. At the moment you're FS is corrupted.

To summarise. If you want to reduce a LV size without Online JFS you have to backup the data in the filesystem, reduce or recreate the LV, create a new FS & then restore the data.

Cheers
Con
James R. Ferguson
Acclaimed Contributor

Re: Can't reduce a lv

Hi (again):

Well, I missed another key fact the first time. You are specifying the new logical volume size as '-L 17,776,640', *but* the capital letter "L" means *megabytes* and the upper limit for it is only 16,777,216 [I added the commas for clarity].

Another way to look at your goal, is that you want to *reduce* the logical volume size, and you don't have OnlineJFS (which might or might not help depending on the version). Thus, since you are going to have to 'newfs' the filesystem contained within the shrunken logical volume, you might as well just 'lvremove' the whole logical volume; then 'vgreduce' the disk you don't want; 'lvcreate' the removed logical volume to the size you want; 'newfs' its filesystem; and lastly load any data you want back to it.

Regards!

...JRF...
Sunil Sharma_1
Honored Contributor

Re: Can't reduce a lv

Hi,

I think your problem is passing parameter to lvreduce command.
Your lvdisplay output shows the size of lvcoolbk is 26000MB and i believe you want it to reduce to 17360MB.
but in command you are giving 17776640 MB which is much higher the originol 26000MB.

You try this syntex.
#lvreduce -L 17360 /dev/vgdatos/lvcoolbk

it will reduce your logical volume.

second thought if you reduce logical volume without online JFS you are going to loose your data or you have to restore data from Backup becoz after reducing logical volume you have to run newfs on that volume, so insted of vreduce you can remove the logical volume and recreate with desired size..

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
GerGon
Regular Advisor

Re: Can't reduce a lv

**************************
Yes, I can reduce it.
**************************
[root@pacifico]/> lvreduce -f -L 16777 /dev/vgdatos/lvcoolbk
Warning: rounding up logical volume size to extent boundary at size "16780" MB.
Logical volume "/dev/vgdatos/lvcoolbk" has been successfully reduced.
************************************
BUT....BUT.. I'm getting the follow error msg:
************************************

[root@pacifico]/> newfs /dev/vgdatos/rlvcoolbk
version 3 layout
17182720 sectors, 4295680 blocks of size 4096, log size 512 blocks
unlimited inodes, 4295680 data blocks, 4294840 free data blocks
132 allocation units of 32768 blocks, 32768 data blocks
last allocation unit has 3072 data blocks
first allocation unit starts at block 0
overhead per allocation unit is 0 blocks
[root@pacifico]/> mount /back
vxfs mount: mount option(s) incompatible with file system /dev/vgdatos/lvcoolbk
[root@pacifico]/> lvdisplay -v /dev/vgdatos/lvcoolbk | more
--- Logical volumes ---
LV Name /dev/vgdatos/lvcoolbk
VG Name /dev/vgdatos
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 16780
Current LE 4195
Allocated PE 4195
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default

--- Distribution of logical volume ---
PV Name LE on PV PE on PV
/dev/dsk/c2t0d0 4195 4195

--- Logical extents ---
LE PV1 PE1 Status 1

can you help me, please?
Massimo Bianchi
Honored Contributor
Solution

Re: Can't reduce a lv

gave another

newfs -F vxfs -o largefiles /....


i think that your original FS was largefiles, but in your command you didn't specify that.
Double check with /etc/fstab

Massimo
Marco Santerre
Honored Contributor

Re: Can't reduce a lv

Hi,

because you're not specifying the lvol to be mounted on your /back, what it does is that it checks against /etc/fstab to see what file system has to be mounted on /back. In this case, chances are, you have some options defined (probably like largefiles) in /etc/fstab and that because you created a new file system (with your newfs command) that don't get recognized with your new FS
Cooperation is doing with a smile what you have to do anyhow.
Pete Randall
Outstanding Contributor

Re: Can't reduce a lv

As stated, the options in /etc/fstab don't agree with the way the file system was created. You can try just mounting it manually:

mount /dev/vgdatos/lvcoolbk /back

That should work, but I think ultimately you're probably going to want to recreate the file system with the options specified in fstab.


Pete


Pete
GerGon
Regular Advisor

Re: Can't reduce a lv

thanks to all, I very apreciate you help.

The problem was resolve.