LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2012, 07:33 AM   #1
DavidDiepUSC
Member
 
Registered: Jan 2008
Posts: 58

Rep: Reputation: 0
Redirect space from one logical volume to another


Hi,

I want to redirect space from one logical volume to another (they are in the same volume group). I think here are the steps, but I'm not sure, can anyone help me verify and let me know if this is a bad way of doing it? I'm using RHEL6.2 using IBM ECKD DASD.

I need space taken away from /opt and moved to /usr, /tmp, and /var:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system_vg-root_lv 4.0G 3.4G 351M 91% /
tmpfs 498M 260K 498M 1% /dev/shm
/dev/mapper/system_vg-boot_lv 93M 25M 64M 29% /boot
/dev/mapper/system_vg-opt_lv 2.0G 35M 1.8G 2% /opt
/dev/mapper/system_vg-tmp_lv 388M 17M 352M 5% /tmp
/dev/mapper/system_vg-usr_lv 2.0G 1.7G 169M 91% /usr
/dev/mapper/system_vg-var_lv 376M 74M 284M 21% /var
I want to move 600 MB out of /opt and distribute it to the afore-mentioned directories.

Shrink filesystem:
#umount /opt
#fsck -f /opt
#resize2fs -p /dev/system_vg/opt_lv 1.4G
Shring logical volume:
#lvresize -L -600MB /dev/system_vg/opt_lv
#mount /home
Display volume group to see if there is Free PE:
# vgdisplay system_vg
Resize /var logical volume:
# lvresize -L +350MB /dev/system_vg/var_lv
Confirm:
#lvdisplay /dev/system_vg/var_lv
#pwd
#df -kh .
Resize:
#resize2fs -p /dev/mapper/system_vg-var_lv
#df -kh .
Repeat for /usr and /tmp

Any feedback will be much appreciated!

Thanks.
 
Old 02-24-2012, 08:06 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
That looks fine to me. There is the -r option to lvresize which would do the resize2fs for you, but I would personally prefer to do it long hand. Only suggestion I'd make is to shrink the ext3 /opt smaller than you actually want, then reduce the LV and then resize /opt to fill the smaller LV, so there's no wasted space at all.
 
Old 02-24-2012, 09:00 AM   #3
DavidDiepUSC
Member
 
Registered: Jan 2008
Posts: 58

Original Poster
Rep: Reputation: 0
Thanks Chris... you can tell how frugal I am with space
 
Old 02-24-2012, 09:17 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
It would annoy the hell out of me! It's a shame I don't *think* there is an easy way to explicitly shrink an LV to the size of the fs inside it, so you can keep a nice neat "df -h" output too!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Need assistance identifying what is using up space in my logical volume Subject16 Linux - Server 2 06-14-2010 05:47 PM
[SOLVED] Adding disk space to root logical volume with pvresize and lvextend bortbortresson Linux - Software 13 12-28-2009 12:59 AM
LVM free space problem after resizing the logical volume wdorninger Linux - Enterprise 0 11-06-2009 08:00 AM
Extending logical volume LogVol01 Insufficient allocatable logical exte swap space umeshsharma Linux - Newbie 4 06-22-2009 01:26 PM
LVM - Extending logical volume - Insufficient free space deim Linux - Newbie 0 04-07-2007 10:47 PM


All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration