LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
LinkBack Search this Thread
Old 02-07-2012, 06:11 AM   #1
rajini23
Member
 
Registered: Sep 2011
Posts: 96

Rep: Reputation: Disabled
Unhappy wants to extend the /home partition


Hi,

I have got 1 workstation configured LVM in it we have low disk space in /home partition, and in root we have nearly 800gb space wants to shrink the /root partition and increase the /home partition...

Please help me on this.....

I user Redhat 6 64bit OS

Partition details.......

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
894G 5.1G 843G 1% /
tmpfs 5.8G 448K 5.8G 1% /dev/shm
/dev/sda3 194M 34M 151M 19% /boot
/dev/sda5 4.0G 2.3G 1.5G 61% /home
/dev/sda2 6.0G 5.0G 1.1G 84% /media/OS
/dev/sda1 196M 9.1M 187M 5% /media/DELLUTILITY
 
Old 02-07-2012, 06:36 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,529
Blog Entries: 1

Rep: Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219
Hello,

Have a look at this Beginner's Guide to LVM. It has everything you need, with examples.

Kind regards,

Eric
 
Old 02-07-2012, 06:37 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 39,821

Rep: Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116
You can't extend /home there, as /home is not LVM already, however you could migrate to a new LVM logvol after first reducing the size of the existing / one.

So first, shrink the / filesystem and then shrink the Logical Volume it is stored in: http://www.tcpdump.com/kb/os/linux/l...de/shrink.html

then create a new LV for home, a new filesystem on it, and then copy the existing /home data to it, edit /etc/fstab to reflect the alternative location and go from there. Actually, you can probably just directly copy the existing partition to the logical volume instead of messing about too much with it - dd if=/dev/sda5 of=/dev/mapper/VolGroup00-LogVolHOME - for example.

btw, you must not confuse the root partition, "/", with "/root". It's certainly confusing, but the difference is very simple.
 
Old 02-07-2012, 10:35 PM   #4
rajini23
Member
 
Registered: Sep 2011
Posts: 96

Original Poster
Rep: Reputation: Disabled
Unhappy

Thank for your reply, I can shrink the / partition and i can create the new LVM group for /home ...
But what happens for that previously created /home partition , if i mount the new LVM with /home after unmounting the previously created /home partition....


I have create new users or previously created user will work ????

Last edited by rajini23; 02-07-2012 at 10:49 PM.
 
Old 02-08-2012, 12:35 AM   #5
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,529
Blog Entries: 1

Rep: Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219
Hello,

Your best option in my opinion is to mount the new LVM 'home' partition on another mountpoint, for example /tmp/home (create the directory if it doesn't exist) and copy all files, maintaining the permissions (-p or --preserve) from /home to /tmp/home. Next umount both /home and /tmp/home and mount the LVM 'home'partition on /home. Change /etc/fstab to point to the new volume and you should be good to go. Normally you won't have to re-create users or anything like that.

Kind regards,

Eric
 
Old 02-08-2012, 01:44 AM   #6
rajini23
Member
 
Registered: Sep 2011
Posts: 96

Original Poster
Rep: Reputation: Disabled
Unhappy

Hi, i have redused the LVM size of / to 10 GB how do i create the new lvm.
i am not able to find any free space....
 
Old 02-08-2012, 01:47 AM   #7
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,529
Blog Entries: 1

Rep: Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219
Hello,

What's the output of
Code:
vgdisplay
Kind regards,

Eric
 
Old 02-08-2012, 01:56 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 39,821

Rep: Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116
Quote:
Originally Posted by EricTRA View Post
Hello,

Your best option in my opinion is to mount the new LVM 'home' partition on another mountpoint, for example /tmp/home (create the directory if it doesn't exist) and copy all files, maintaining the permissions (-p or --preserve) from /home to /tmp/home. Next umount both /home and /tmp/home and mount the LVM 'home'partition on /home. Change /etc/fstab to point to the new volume and you should be good to go. Normally you won't have to re-create users or anything like that.

Kind regards,

Eric
I don't think this is the best approach actually. As it's one entire filesystem to another he can dd the entire block device across and then just use resize2fs to make it fill the LV.
 
1 members found this post helpful.
Old 02-08-2012, 02:22 AM   #9
rajini23
Member
 
Registered: Sep 2011
Posts: 96

Original Poster
Rep: Reputation: Disabled
Hi have created the lvm in resized space for 10Gb,
but i am not able create pvcreate,vgcreate,vgextend said it is already created..

so i have directly created lv create with Volgroup00 which is created previously....

Is that right what i have created ....
 
Old 02-08-2012, 02:24 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 39,821

Rep: Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116
well you've not shown us what you created. as above, show us the output from vgdisplay / lvdisplay

be VERY aware of the differences, you would want an lvcreate, not a vgcreate, as your volume group already exists and is fine.
 
Old 02-08-2012, 05:39 AM   #11
rajini23
Member
 
Registered: Sep 2011
Posts: 96

Original Poster
Rep: Reputation: Disabled
Unhappy

Hi i have created the LVM with the free space as you said i have created the directory /tmp/home for my /home partition and moved all the files from /home to /tmp/home directory...

and unmounted the /home and mounted my new LVM partition into /home.. and copied all the files from /tmp/home to /home lvm partition now i am not able to login with previously created user account.....
 
Old 02-08-2012, 05:54 AM   #12
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 39,821

Rep: Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116Reputation: 1116
as above, I would STRONGLY suggest cloning the filesystem using dd, as that way, as long as that one command is run correctly and the filesystem is mounted normally, it's basically impossible for it to not work.
 
Old 02-09-2012, 12:36 AM   #13
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,529
Blog Entries: 1

Rep: Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219
Quote:
Originally Posted by acid_kewpie View Post
I don't think this is the best approach actually. As it's one entire filesystem to another he can dd the entire block device across and then just use resize2fs to make it fill the LV.
Hi,

Thanks for pointing me back to the basics. Completely overlooked that one, my bad.

Kind regards,

Eric
 
Old 02-09-2012, 12:39 AM   #14
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,529
Blog Entries: 1

Rep: Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219
Quote:
Originally Posted by rajini23 View Post
Hi i have created the LVM with the free space as you said i have created the directory /tmp/home for my /home partition and moved all the files from /home to /tmp/home directory...

and unmounted the /home and mounted my new LVM partition into /home.. and copied all the files from /tmp/home to /home lvm partition now i am not able to login with previously created user account.....
Hello,

You state you moved the files. What exactly did you do? Use the 'mv' command? I mentioned in a previous post cp with the -p or --preserve argument to keep permissions. If you didn't use that then most likely your permissions are all off and you'll need to review them. To avoid these things you'd best take acid_kewpie's advice and use dd.

Kind regards,

Eric
 
Old 02-09-2012, 04:32 AM   #15
rajini23
Member
 
Registered: Sep 2011
Posts: 96

Original Poster
Rep: Reputation: Disabled
Smile

ya, i used the same command "dd" and its working i can able to access /home partition with newly configured lvm all the data are retrieved .....
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to extend /home or / partition through LVM smilemukul Linux - Newbie 9 01-29-2012 11:07 PM
How to add second sata drive and extend /home to it? gimmee Fedora 7 11-09-2007 09:29 PM
How to extend /home partition in rhel4? kathmanduite Linux - Newbie 4 09-06-2007 08:40 AM
How to extend /home fw12 Linux - Software 5 09-06-2006 07:04 PM
extend /home filesystem size rtmisa Linux - Newbie 6 10-10-2003 08:36 AM


All times are GMT -5. The time now is 04:10 PM.

Main Menu
 
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
Open Source Consulting | Domain Registration