Ask Your Question
1

How to move storage from Partition to LVM /home that's part of that partition?

asked 2017-10-04 10:11:08 -0600

d4z3dNc0nfu53d gravatar image

Hi,

I have a lot of extra space on partition sda5 that I'd like to give to /home (fedora-home). Unfortunately, this is something I am not well-versed in and would really appreciate any assistance. How can I move that extra 497.6 GB to the home LVM if they're on the same partition?

Below is the output from running fdisk -l, lsblk, and df -Th.

    > fdisk -l

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xd223b240

Device     Boot     Start        End    Sectors   Size Id Type
/dev/sda1            2048  500000767  499998720 238.4G 83 Linux
/dev/sda2       500000768  515624959   15624192   7.5G 82 Linux swap / Solaris
/dev/sda3       515624960  517722111    2097152     1G 83 Linux
/dev/sda4       517722112 1953523711 1435801600 684.7G  5 Extended
/dev/sda5       517724160 1953523711 1435799552 684.7G 8e Linux LVM


Disk /dev/mapper/fedora-root: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/fedora-swap: 7.8 GiB, 8405385216 bytes, 16416768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/fedora-home: 129.3 GiB, 138797907968 bytes, 271089664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


 > lsblk 

   NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda               8:0    0 931.5G  0 disk 
    ├─sda1            8:1    0 238.4G  0 part 
    ├─sda2            8:2    0   7.5G  0 part 
    ├─sda3            8:3    0     1G  0 part /boot
    ├─sda4            8:4    0     1K  0 part 
    └─sda5            8:5    0 684.7G  0 part 
      ├─fedora-root 253:0    0    50G  0 lvm  /
      ├─fedora-swap 253:1    0   7.8G  0 lvm  [SWAP]
      └─fedora-home 253:2    0 129.3G  0 lvm  /home
    sr0              11:0    1  1024M  0 rom  


    > df -Th

Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                   tmpfs     3.9G   23M  3.9G   1% /dev/shm
tmpfs                   tmpfs     3.9G  2.1M  3.9G   1% /run
tmpfs                   tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/fedora-root ext4       50G   16G   31G  34% /
tmpfs                   tmpfs     3.9G   36K  3.9G   1% /tmp
/dev/sda3               ext4      976M  188M  721M  21% /boot
/dev/mapper/fedora-home ext4      128G  105G   17G  87% /home
tmpfs                   tmpfs     789M   12K  789M   1% /run/user/42
tmpfs                   tmpfs     789M   36K  789M   1% /run/user/1000
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2017-10-04 20:15:29 -0600

jmt gravatar image

updated 2017-10-04 20:17:21 -0600

You seem to have a lot of unused space on your volume group "fedora" which resides on partition /dev/sda5

To allocate more space for your logical volume "fedora-home" where your /home partition resides, you need to do the following (as root):

Please first use the commands pvs, vgs and lvs to get to know your LVM structure a little bit better. Then you can extend you "fedora-home" logical volume using:

lvextend --size=+100G --resizefs /dev/fedora/home

The 100G here is just an example.

If you want to allocate all that space to you /home partition, do the following:

vgdisplay fedora

See the number of free physical extents (Free PE) on you volume group and then extend the "fedora-home" logical volume by the same amount:

lvextend --extents=+NNN --resizefs /dev/fedora/home

where NNN is the number of free extents you saw before.

In the end managing LVM is not so hard once you get the hang of it.

edit flag offensive delete link more

Comments

Sorry for the delay! I was notified that this question had been closed as a duplicate, and didn't realize it got answers! :)

sudo vgdisplay gives me the following:

--- Volume group --- VG Name fedora Format lvm2 VG Size 187.09 GiB PE Size 4.00 MiB Total PE 47896 Alloc PE / Size 47896 / 187.09 GiB Free PE / Size 0 / 0

sudo lvextend --size=+100G --resizefs /dev/fedora/home gives me: Insufficient free space: 25600 extents needed, but only 0 available

Where's my extra storage? :)

d4z3dNc0nfu53d gravatar imaged4z3dNc0nfu53d ( 2017-10-10 21:17:40 -0600 )edit

Booted up GParted, and got a warning telling me to run Partition > Check on my partition. After doing that, I was able to see the storage and perform your steps! Thanks a bunch! :)

d4z3dNc0nfu53d gravatar imaged4z3dNc0nfu53d ( 2017-10-11 13:23:26 -0600 )edit
-1

answered 2017-10-04 12:34:32 -0600

MettaCrawler gravatar image

updated 2017-10-04 12:34:56 -0600

Partition sda5 is currently in use by LVM. To mess with it would be very bad.

To demonstrate the way that sda5 is in use try: sudo pvdisplay /dev/sda5 you can read about pvdisplay by running man pvdisplay and pvdisplay --help.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-10-04 10:11:08 -0600

Seen: 318 times

Last updated: Oct 04 '17