[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: [LINUX-LVM] shrinking a volume inside an LVM



Most of this makes sense. Especially the part about using a live CD. But if you don't mind I'm gonna pick your brain on the other parts because I like to understand a command before I use it, so I can blame myself when I mess up ;-) 
Actually the only part I'm unsure about is 9-11. resize2fs will resize my ext2/3 file system which will clear up more room in my lvm to create another lv correct? Or do you have to shrink the file system then the lv to have the space back? I'm going to back up anything that I need to be safe, but I'd like to avoid a total reinstall right now(that's for May). Thanks again. I think you've got me on track. One more quick one, on 9 you said "amount occupied + some" wouldn't it be minus some?


Levi

-----Original Message-----
From: linux-lvm-bounces redhat com on behalf of Brian McCullough
Sent: Fri 1/4/2008 1:38 PM
To: LVM general discussion and development
Subject: Re: [LINUX-LVM] shrinking a volume inside an LVM
 
On Fri, Jan 04, 2008 at 01:07:42PM -0600, Kemp, Levi wrote:
> I'm sure it's been asked before, but I must be terrible at searching because I cannot find the answer. I have, like many, followed defaults and ended up wiht a boot partion and a lvm. Inside the lvm is a / and a swap. I'd like to shrink the / so that I can do another install of a different distro without upsetting my current one. I don't have another computer, or equal setup to run my test on and cannot take this one down yet either. If it's impossible let me know, but either way thanks for the help.

This is relatively easy, as long as you are careful.

First, which filesystem format are you using?  I will base my answer on
ext2/ext3, because that's what I am most familiar with, others can
answer better if you have something else.


Second, I presume from your question that / is not full.


1. Boot with a Rescue Disk or Live CD ( you need to make sure that your
LVM is not Live and being used. )

2. Start a terminal window and run:

3. vgchange -a y

4. e2fsck -f /dev/"volgroupname"/"volname of '/'"  ( you can fill in the
blanks )

5. mkdir /mnt1

6. mount /dev/"volgroupname"/"volname of '/'" /mnt1

7. df ( check the amount of space occupied in / )

8. umount /mnt1

9. resize2fs /dev/"volgroupname"/"volname of '/'" "amount occupied +
some"

10. lvreduce -L "size from 9" /dev/"volgroupname"/"volname of '/'" 
( If you want to be extra paranoid, you can add a "-t" parameter once,
and then run it without. )

11. resize2fs /dev/"volgroupname"/"volname of '/'" 
( This will adjust the filesystem to fit the Logical Volume. )


At this point, you should have a smaller / volume and some free space.
Note that resize2fs will insist on the e2fsck, and may require it more
often than I have shown.

I have put in a couple of paranoia steps, such as 6-8, to make sure that
you are using the correct sizes in the next couple of steps.



Have fun!
Brian


_______________________________________________
linux-lvm mailing list
linux-lvm redhat com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

<<winmail.dat>>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]