LinuxQuestions.org
Register a domain and help support LQ
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 12-03-2012, 10:22 PM   #1
SevenDP
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Rep: Reputation: Disabled
[HELP] RHEL6.2 Resize LVM Partition


i have running server using RHEL 6.2 64bit
but i have wrong partition

[root@mail ~]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mail-lv_root
53G 12G 39G 23% /
tmpfs 4.2G 91k 4.2G 1% /dev/shm
/dev/sda1 508M 38M 444M 8% /boot
/dev/mapper/vg_mail-lv_home
675G 207M 641G 1% /home


[root@mail ~]# cat /etc/fstab
/dev/mapper/vg_mail-lv_root / ext4 defaults 1 1
UUID=7d13f9fe-4227-4c84-b57d-35b605a03df8 /boot ext4 defaults 1 2
/dev/mapper/vg_mail-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_mail-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0

i wish i can make / bigger and /home smaller, or merge /home to /
so / have 53GB + 675GB

/ --- have data i do not want to lose
/home --- is empty just lost&found directory

thanks
denny
 
Old 12-04-2012, 03:52 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,028
Blog Entries: 5

Rep: Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791
You can reduce the size of /home since it is unused and increase / on line:

***WARNING: SINCE THIS IS ROOT YOUR MUCKING WITH BE SURE YOU HAVE A GOOD BACKUP FIRST***

My notes show reduction of /home must be done offline (with filesystem unmounted)
Requires a filesystem check with e2fsck be done
Filesystem can then be reduced using resize2fs.
The LV can then be reduced using lvreduce.

df -h /home (to see current size)
umount /home
esfsck -f /dev/mapper/vg_mail-lv_home
resize2fs /dev/mapper/vg_mail-lv_home <newsize you desire>
lvreduce -L <new size you desire> /dev/mapper/vg_mail-lv_home
mount /dev/mapper/vg_mail-lv_home /home
df -h /home (should now show new size)

You can then easily extend root by running:
lvextend -L <new size you desire greater than current size> /dev/mapper/vg_mail-lv_root
resize2fs -p /dev/mapper/vg_mail-lv_root
df -h / (to verify new size)

You can get more details on size specifications and/or other options for each of the commands by typing "man <command>"
 
1 members found this post helpful.
Old 12-05-2012, 04:31 AM   #3
SevenDP
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
You can reduce the size of /home since it is unused and increase / on line:

***WARNING: SINCE THIS IS ROOT YOUR MUCKING WITH BE SURE YOU HAVE A GOOD BACKUP FIRST***

My notes show reduction of /home must be done offline (with filesystem unmounted)
Requires a filesystem check with e2fsck be done
Filesystem can then be reduced using resize2fs.
The LV can then be reduced using lvreduce.

df -h /home (to see current size)
umount /home
esfsck -f /dev/mapper/vg_mail-lv_home
resize2fs /dev/mapper/vg_mail-lv_home <newsize you desire>
lvreduce -L <new size you desire> /dev/mapper/vg_mail-lv_home
mount /dev/mapper/vg_mail-lv_home /home
df -h /home (should now show new size)

You can then easily extend root by running:
lvextend -L <new size you desire greater than current size> /dev/mapper/vg_mail-lv_root
resize2fs -p /dev/mapper/vg_mail-lv_root
df -h / (to verify new size)

You can get more details on size specifications and/or other options for each of the commands by typing "man <command>"
thanks MensaWater
i will try that after i prepare backup server this week.
this is online mail server so i have to shutdown it on holiday
and i will update this thread after that

thanks
regards
denny
 
Old 12-05-2012, 08:34 AM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,028
Blog Entries: 5

Rep: Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791
The main point in my email was that you shouldn't need to shutdown to do this.

If /home is empty it likely isn't in use so can be unmounted. You can run "lsof /home" to see if anything is using it.

Since you're expanding rather than reducing root it can be done with root online.

It wasn't clear if you meant you're doing the shutdown to setup backups or not. I wouldn't think that would be necessary but I use NetBackup so maybe its different for whatever you're using.
 
  


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 ro resize LVM partition starqazi Linux - Newbie 2 07-11-2012 07:25 PM
[SOLVED] lvm / resize partition problem ghostshell Linux - Newbie 4 02-14-2012 06:53 AM
Partition resize for LVM mhouston100 Linux - Server 9 06-07-2010 11:07 PM
How To Resize LVM Partition sfo Linux - General 1 09-17-2006 12:39 PM
resize LVM partition bkesting Linux - General 3 06-17-2005 10:28 AM


All times are GMT -5. The time now is 05:01 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