LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-21-2017, 10:21 PM   #16
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957

Code:
lvrename fedora root home
mkfs.ext4 /dev/fedora/home
mkdir -p /mnt/tmphome
mount /dev/fedora/home /mnt/tmphome
cp -a /home/. /mnt/tmphome
Note the "." on the end of "/home/.". It is important. Don't leave it out.

Then, edit the "/home" line in /etc/fstab to read
Code:
/dev/mapper/fedora-home /home                   ext4    defaults,nofail        1 2
Note, that's just changing "fedora00" to "fedora" and adding a "nofail" option (temporarily) so that the system will still boot even if something goes wrong there.

Then reboot. You should be up and running with your new 50GB /home. At your leisure, you can remove the "nofail" option from the /etc/fstab line, delete the /mnt/tmphome directory, and delete the "fedora00" volume group with "vgremove fedora00". (You will be prompted to delete the fedora00-home LV).
 
1 members found this post helpful.
Old 01-21-2017, 10:24 PM   #17
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by milter View Post
Something that I don't understand: won't clearing out that 50GB LV fedora-root only get me another 50gb? I'm using a 1tb drive that I tried to split evenly between Windows and Fedora, so I would think that I should have at least 400gb to work with on my Fedora home partition...
There should be plenty of space in that "fedora" VG to expand the LVs there or create new ones. The vgs command should show you how much space is free.
 
Old 01-21-2017, 10:51 PM   #18
milter
LQ Newbie
 
Registered: Apr 2016
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
There should be plenty of space in that "fedora" VG to expand the LVs there or create new ones. The vgs command should show you how much space is free.
OK. I followed the steps with no hiccups or problems. "vgs" shows me a "fedora" vg with 358.70g free, which seems right. But when I right click on my "Home" directory and choose "properties", it says I only have 49.4GB free. Why is that?
 
Old 01-22-2017, 01:14 AM   #19
GentleThotSeaMonkey
Member
 
Registered: Dec 2016
Posts: 61
Blog Entries: 2

Rep: Reputation: 27
Because old root LV was 50G, minus the 500M home you cp'ed in there. See ToDo below.
Code:
lsblk -o name,fstype,mountpoint,size
might be more interesting.

fyi, note 1G sda4 is physically right after 100M sda2 (sda2 is non-LVM FAT16/vfat /boot/efi)
Then comes sda3, to [within 1457 little sectors of] the physical end of the disk.
Doesn't matter tho.

A lot of 463.7G sda3 PV, tho 'all owned' by VG fedora, is unallocated to any LVs.
Both the current 50G root00 (and 50G prior-root-now-home), plus swap, are allocated from there.

Maybe a 2nd install created root00 LV &added fedora00 VG sda5/4,
but I can't guess why the 1G 'gap' between sda2&3 [initially?].
/etc/lvm/backup/* might provide some 'time' history forensic info; Idk.

I've enjoyed following this, &[re]learning LVM! And esp. 'nofail' +1 #16
Study: ls -l /dev/fedora* /dev/mapper /dev/dm-* /dev/block /dev/disk/*

ToDo: make LV fedora-home bigger. (there's 358.7G available in VG fedora)
lvresize --size +50G /dev/fedora/home (I think!)
Don't give all 358.7G to home; you very well may need some for root00 someday!

Last edited by GentleThotSeaMonkey; 01-22-2017 at 04:55 AM.
 
Old 01-22-2017, 08:29 AM   #20
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by GentleThotSeaMonkey View Post
ToDo: make LV fedora-home bigger. (there's 358.7G available in VG fedora)
lvresize --size +50G /dev/fedora/home (I think!)
You need to include the "--resizefs" option, otherwise you end up with a large LV with a small filesystem inside it, just like what happens when you enlarge a partition without enlarging its filesystem.
Code:
lvresize --resizefs --size +50G /dev/fedora/home
You can safely enlarge an ext4 filesystem while it is in use. It's just shrinking one that has to be done offline. Similarly, you can enlarge the filesystem later by running "resize2fs /dev/fedora/home", but you can't get away with that when shrinking -- the shrinking of the filesystem has to come first or during the same operation.
 
Old 01-22-2017, 11:11 AM   #21
milter
LQ Newbie
 
Registered: Apr 2016
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
Code:
lvresize --resizefs --size +50G /dev/fedora/home
You can safely enlarge an ext4 filesystem while it is in use. It's just shrinking one that has to be done offline. Similarly, you can enlarge the filesystem later by running "resize2fs /dev/fedora/home", but you can't get away with that when shrinking -- the shrinking of the filesystem has to come first or during the same operation.
Just so I understand, the above code will increase my home partition by 50G? And I have about 358G free? So I can safely changed that 50G to, say, 300G? i.e.

Code:
lvresize --resizefs --size +300G /dev/fedora/home
 
Old 01-22-2017, 12:11 PM   #22
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
If you look at the manpage for lvresize or lvextend you will see there are several ways to specify the size. You could specify a percentage of the free space in the volume group, "-l +75%FREE" or "-l +100%FREE". As has been suggested, it might be best not to grab all the free space unless you know you're going to need it. Enlarging an LV and filesystem is easier than shrinking one, and can be done again at any time.
 
Old 01-22-2017, 01:17 PM   #23
milter
LQ Newbie
 
Registered: Apr 2016
Posts: 28

Original Poster
Rep: Reputation: Disabled
Excellent. Thank you very much.
 
  


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
Help with partition sizes S.V. Linux - Newbie 8 12-28-2006 10:38 AM
partition sizes fstreed SUSE / openSUSE 10 05-07-2005 08:58 AM
Partition sizes? murbz Linux - Software 3 07-22-2004 08:43 AM
Partition Sizes JonyKyte Linux - Newbie 12 12-23-2003 07:48 AM
partition sizes scrambled2k3 Linux - Newbie 7 02-21-2003 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:50 PM.

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