LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 02-28-2008, 05:08 PM   #1
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Rep: Reputation: 15
Shrinking a Logical Volume With LVM


hi,
I have a centOS 5 server with LVM,
[root@p3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
17G 3.7G 13G 23% /
/dev/hda1 99M 25M 70M 26% /boot
tmpfs 256M 0 256M 0% /dev/shm
[root@p3 ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw,size=256m)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

since the "/" take all the space, I want to shrink it, but how can I umount it?

[root@p3 ~]# umount /
umount: /: device is busy
umount: /: device is busy

thanks in advance!
jimmy
 
Old 02-28-2008, 05:45 PM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
I'm not sure this is something you can do while running on the root volume.

The easiest route (or the route I'd take) will probably be to boot to rescue media, activate the VolumeGroup, force fsck /dev/VolGroup00/LogVol00, resize2fs to the reduced size you want, lvreduce the LogicalVolume.

Keep in mind that if you reduce it too much (smaller than you have data consumption) you'll run into problems. also, you don't want to reduce the LV smaller than the filesystem. I usually fudge an extent or two just to be safe.

May not be a bad idea to have a backup of anything you want to keep ahead of time... just in case.

If all goes well, then you reboot successfully and use the reclaimed extents for whatever other Logical Volume(s) you want.
 
  


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
How to Resize Root LVM Logical Volume??? jdupre Fedora 17 10-02-2010 08:21 AM
LVM: The Impact of Reducing a Logical Volume Size? muff Linux - General 0 07-27-2007 03:18 AM
LVM - Extending logical volume - Insufficient free space deim Linux - Newbie 0 04-07-2007 10:47 PM
a doubt on shrinking logical volume nirmaltom Linux - General 6 02-14-2007 01:46 AM
LVM: How to create logical (physical) volume with extent sie 32 Mb consistgd Linux - Software 4 11-14-2006 06:03 PM


All times are GMT -5. The time now is 03:13 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration