1827807 Members
2300 Online
109969 Solutions
New Discussion

lvm & resize

 
Josef Forman
Frequent Advisor

lvm & resize

How can I change size of my LV (reiser and ext3) without loosing data?
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: lvm & resize

If you are using lvm for disk managment, the command is lvreduce.

Helpful hints
1) Back up your data before you start, if you squeeze too hard, you'll hammer your data.


SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jerome Henry
Honored Contributor

Re: lvm & resize

Extending is most of the time ok :
lvextend -L +50M /dev/vgname/lvname
or
lvextend -L 450M /dev/vgname/lvname

Where vgname is your group volume name, and lvname your Logical volume name.
You can use the +50M (say) to increase for 50 M, or put directly required new size.

SAme with lvreduce, but it's safer to backup, as it's supposed to be safe if you reduce to a size larger than your data volume, but it happends that datas are altered...

hth

Jerome Henry
You can lean only on what resists you...
Jan Sladky
Trusted Contributor

Re: lvm & resize

hi AliG,
what do you mean by the change of size - extending fs or reducing ? I have some hints for reiserfs:

BACKUP YOUR DATA FIRST

In case of Reiser extending:
1.vgdiplay -v #check free space on currentVG
2.lvextend -L +6G /dev/vg00/lv00
3.resize_reiserfs /dev/vg00/lv00

In case of Reiser reducing ON value:
1.reduce the size of fs:
resize_reiserfs -s-2048M -f /dev/vg02/lv00

2.reduce size of LV
lvreduce -L-2G /dev/vg02/lv00

Be carefful, although you can do resizing on mounted fs, it is safer to do it on unmounted.

br Jan



GSM, Intelligent Networks, UNIX
Marco Di Ianni
Frequent Advisor

Re: lvm & resize

What do you want to do?!?!
Do you want extend or reduce logical volume?!

If you want extend the command is:

# lvextend -L 500 /dev/vg_name/lv_name

where 500 is the new size of volume

If you want reduce the LV is:

# lvreduce -L 500 /dev/vg_name/lv_name

(BACKUP YOUR DATA BEFORE REDUCE LV!!)

Bye!
Josef Forman
Frequent Advisor

Re: lvm & resize

I need to extend my LV from 100GB to 150GB. Is it safe or i should backup too?

PF
Marco Di Ianni
Frequent Advisor

Re: lvm & resize

No.....for extend operation you don't need to backup data, this operation is not dangerous! Don't worry!

Steven E. Protter
Exalted Contributor

Re: lvm & resize

I would back up the data prior to the extend

There are rare cases on hp-ux (from whece lvm comes), where an extend failed and corrupted the filesystem.

Extending a logical volume is much safer than trying to make it smaller.

The process is:

lvextend -L /name_of_lvol /disk
umount the filesystem
extendfs

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com