LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-08-2007, 06:06 AM   #1
alexpacio
LQ Newbie
 
Registered: Apr 2006
Posts: 23

Rep: Reputation: 15
Question Resizing Centos (ext3/LVM) partition


Hi,
How can I resize (shrinking) an ext3/LVM partition created by Centos 5's Anaconda?
 
Old 08-08-2007, 06:33 AM   #2
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 399

Rep: Reputation: 40
For example if you want to shrink a 100G partition to 50G:
Code:
# rsync -rv /mount/point/* /srv/backups
# umount /mount/point
# fsck.ext3 /dev/mapper/lv_lvname
# resize2fs /dev/mapper/lv_lvname 50G
# lvresize -v -L -50G /dev/vg_vgname/lv_lvname
Quote:
lvresize allows you to resize a logical volume. Be careful when reducing a logical volume's size, because data in the reduced part
is lost!!! You should therefore ensure that any filesystem on the volume is shrunk first so that the extents that are to be removed
are not in use. Resizing snapshot logical volumes (see lvcreate(8) for information about creating snapshots) is supported as well.
But to change the number of copies in a mirrored logical volume use lvconvert(8).
 
Old 08-08-2007, 01:07 PM   #3
alexpacio
LQ Newbie
 
Registered: Apr 2006
Posts: 23

Original Poster
Rep: Reputation: 15
Is it necessary to backup data before proceeding (rsync -rv /mount/point/* /srv/backups) ?
 
Old 08-09-2007, 12:53 AM   #4
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 399

Rep: Reputation: 40
If the data is important you should have a backup anyway. In my point of view the shrinking of a filesystem is more dangerous than extending it. For example if there is only a slight difference in how the programs calculate the parameters for the sizing you might end up with a filesystem that is truncated. In that case not only the data that was cut off is lost but there is also the possibility that you get a corrupted filesystem that may be never restored again.

Usually I shrink my filesystem more than I shrink the lvm or the actual partition. Then I extend the filesystem to the maximum possible amount.

Last edited by brianmcgee; 08-09-2007 at 12:56 AM.
 
Old 08-09-2007, 10:22 AM   #5
alexpacio
LQ Newbie
 
Registered: Apr 2006
Posts: 23

Original Poster
Rep: Reputation: 15
Thank you for the fast reply.

If I have any problem I will notice them in this post...

Thank you again!
 
Old 08-10-2007, 09:34 AM   #6
alexpacio
LQ Newbie
 
Registered: Apr 2006
Posts: 23

Original Poster
Rep: Reputation: 15
I tried to procced through the 'linux rescue' option of the centos installation cd but when i try to unmount the partition it say that I can-t do it {i tried with force option too]...Is it possible that I can't resize a LVM partition ?

PLEASE HELP ME!
 
Old 08-11-2007, 01:39 AM   #7
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 399

Rep: Reputation: 40
You sure can resize a LVM partition. Did you try to unmount the root partition in the rescue mode? Because the actual system wil be mounted under /mnt/sysimage/

The unmount is needed for the filesystem check. Ext3 can be resized online.
 
  


Reply



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
LVM: Resizing the root partition fulat2k Linux - General 6 01-08-2012 04:35 PM
resizing non-LVM partition laggerific Linux - Software 1 11-09-2006 06:20 PM
Resizing an ext3 LVM Partition PenguinPwrdBox Linux - Software 1 09-04-2005 02:34 AM
need help resizing an ext3 partition with an underlying partition... spiroth10 Linux - Software 1 07-30-2004 12:21 PM
Resizing a partition (ext3) herc Linux - Hardware 1 12-26-2003 04:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:38 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
Open Source Consulting | Domain Registration